show a code snipset
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=3922735#3922735
Reply to the post :
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3922735
---
This SF.net email is
So, for further enlightenment could you provide a code snippet of a stateless
session bean that contains a method for returning a list of regions from a
specific country code? A partial compound key lookup. I have never gotten one
of those to work.
Thanks
View the original post :
i forgot to add referencedColumName to the JoinColumn Annotation when defining
the foreign composite key relationship.
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=3915149#3915149
Reply to the post :
yep.. I finally sorted this one out.
I'll post the code for my files for a reference as this is a slightly different
example to the one in the wiki.
I've included the location class which shows how the composite foreign key is
referenced.
@Entity
| @Table(name=country)
| public class
did you remove this one
@OneToMany(fetch=FetchType.LAZY,mappedBy=country)
| public java.util.ListCountryRegion getCountryRegion() {
| return countryRegion;
| }
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=3915034#3915034
Reply to the
only Basic, Column, Lob, Temporal, and Enumerated can be used to map a
@Embedded class. Thus, you can't use Country as a primary key. That's one
problem I see. Another is that the @OneToMany on Country to CountryRegion is
not bidirectional, so the mappedby would not work. You'd have to do:
Thanks Bill,
I'll give that a go an let you know of the results.
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=3914854#3914854
Reply to the post :
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3914854
I've just set things up the way you have suggested.
My PK class now has a String value referring to the country_code_1 rather than
the actual country object.
@Embeddable
| public class CountryRegionPK implements java.io.Serializable{
| ...
|
|public String getCountryCode1()