Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6855

Re: Hibernate foreign key as primary key

From Frank Langelage <frank@lafr.de>
Newsgroups comp.lang.java.programmer
Subject Re: Hibernate foreign key as primary key
Date 2011-08-07 18:45 +0200
Message-ID <9a7tq6FspmU1@mid.individual.net> (permalink)
References <4e3e78a1@dnews.tpgi.com.au>

Show all headers | View raw


On 07.08.11 13:38, Lionel wrote:
> This may be a little off topic but I'm sure there are some experts in here.
>
> I'm having some troubles getting using a foreign key as a primary key.
> In this post I will use the most simple issue I'm having trouble with.
>
> Here's some snippets (pharmacy project):
>
> public abstract class AbstractDrugModel
> {
> private String name;
> private IntravascularDrug ivDrug;
> }
>
> public class IntravascularDrug
> {
> private AbstractDrugModel drug;
> }

I can't help you with your problem but want to give a comment to this mail.
Your class design does not make sense to me. You have a circular 
reference between these two classes. Java allows this, but this is bad 
design in my eyes.
And this might be the cause that hibernate cannot work with this design.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hibernate foreign key as primary key Lionel <lionelv@none.com> - 2011-08-07 21:38 +1000
  Re: Hibernate foreign key as primary key markspace <-@.> - 2011-08-07 07:07 -0700
  Re: Hibernate foreign key as primary key Robert Klemme <shortcutter@googlemail.com> - 2011-08-07 18:03 +0200
  Re: Hibernate foreign key as primary key Frank Langelage <frank@lafr.de> - 2011-08-07 18:45 +0200
    Re: Hibernate foreign key as primary key Robert Klemme <shortcutter@googlemail.com> - 2011-08-07 19:14 +0200
      Re: Hibernate foreign key as primary key Lionel <lionelv@none.com> - 2011-08-08 20:11 +1000
        Re: Hibernate foreign key as primary key Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-08 18:26 -0300
          Re: Hibernate foreign key as primary key Lionel <lionelv@none.com> - 2011-08-09 18:56 +1000
            Re: Hibernate foreign key as primary key Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-09 21:45 -0300
        Re: Hibernate foreign key as primary key Lew <lewbloch@gmail.com> - 2011-08-10 09:58 -0700

csiph-web