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() {...}
  | 
  |    public void setCountryCode1(String countryCode1) {.... }

@Entity
  | @Table(name = "country_region")
  | public class CountryRegion implements Serializable {
  | ........
  |     @EmbeddedId
  |     @AttributeOverrides({
  |          @AttributeOverride(name = "regionCode", column = @Column(name = 
"region_code")),
  |          @AttributeOverride(name = "countryCode1", column = 
@Column(name="country_code_1"))
  |        })
  | 

However I am still getting the error below. I'm guessing that it is due to my 
Location table relationship. see bottom.

org.hibernate.AnnotationException: A Foreign key refering CountryRegion has the 
wrong number of column. should be 2


  | @Entity
  | @Table(name="location")
  | public class Location implements Serializable{
  | ...........
  |     @ManyToOne
  |     @JoinColumns ( [EMAIL PROTECTED](nullable=false, name="region_code"), 
@JoinColumn(nullable=false, name="country_code_1")})
  |     public CountryRegion getCountryRegion() {
  |             return countryRegion;
  |     }
  | 


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914881#3914881

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914881


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to