Hi all,

I have this situation:
2 entities, country and state
country has code and name as fields, code is PK
state has code, name and country_code (linked to country code field) as fields, 
code is PK and country_code should too.



  | @Entity @Table(name="country")
  | class Country implements Serializable{
  | @Id @Column(name="code",length=2)
  | private String code;
  | @Column(name="name",length=50)
  | private String name;
  | 
  | //setters and getters here
  | }
  | 
then 

  | @Entity @Table(name="state")
  | class State implements Serializable{
  | @Id @Column(name="code",length=2)
  | private String state;
  | @Column(length=50)
  | private String name;
  | @ManyToOne
  | @JoinColumn(name = "countryCode", nullable = false)
  | private Country country; //<-- should be PK too!!!
  | //setters and getters here
  | }
  | 

Can someone help me to understand this?
Thank you all in advance

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

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


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to