Well I thougth that you have a problem with your mapping, because
Record has a composite key and in the relation with RecordDetails you
only map "seqId".
I am not an expert on hibernate, it is only a novice opinion.

2010/7/1, Sean Comerford <[email protected]>:
> Hours of googling have failed so I'm hoping one of you JavaPosse list
> geniuses can bail me out here :-)
>
> I have what I think is a pretty simple relationship between two DB tables.
>
> Record
> ---------
>      int seqId (key)
>      int owner (key)
>      String source (key)
>      ... other non key fields ...
>
> RecordDetails
> -------------------
>     int genId (key)
>     int seqId
>     String detailsText
>
> So record has a one to many relationship with record details based on the
> seqID.
>
> The catch here is the primary key in the record table is COMPOSITE
> consisting of seqId, owner and source (whereas RecordDetails pk is just the
> generated column genId).
>
> Starting with just having:
>
> @OneToMany
> @JoinColumn(name="seqId")
> private List<RecordDetails> details ...
>
> I've tried 18 different ways to model this in JPA / Hibernate and after much
> googling still can't get it to work.
>
> The jist of my googling seems to be that there's a limitation in JPA 1.0 in
> that ManyToOne and OneToMany relationships on foreign keys MUST have the
> same key columns.
>
> My gut feeling is there MUST be a way around this... I'm willing to use
> Hibernate annotations if necessary.
>
> Can anyone help me out?
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
>


-- 
Lezcano, H. Adrian

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to