I have a scenario, which is very easy: Gender 1 --- * Singer

So in Singer class, I have a Gender object where in Gender class, I have list 
of Singer objects.  Here are the source codes:


  | public class Gender implements Serializable {
  |     private long id;
  |     private String type;
  |     private String description;
  |     private List singer;
  |     public Gender() {
  |             super();
  |             // TODO Auto-generated constructor stub
  |     }
  |     public String getDescription() {
  |             return description;
  |     }
  |     public void setDescription(String description) {
  |             this.description = description;
  |     }
  |     public long getId() {
  |             return id;
  |     }
  |     public void setId(long id) {
  |             this.id = id;
  |     }
  |     public String getType() {
  |             return type;
  |     }
  |     public void setType(String type) {
  |             this.type = type;
  |     }
  |     public List getSinger() {
  |             return singer;
  |     }
  |     public void setSinger(List singer) {
  |             this.singer = singer;
  |     }
  | }
  | 


  | public class Singer implements Serializable {
  |     private long id;
  |     private String firstname;
  |     private String lastname;
  |     private Gender gender;
  | 
  |     public Singer() {
  |             super();
  |             // TODO Auto-generated constructor stub
  |     }
  | 
  |     public String getFirstname() {
  |             return firstname;
  |     }
  |     public void setFirstname(String firstname) {
  |             this.firstname = firstname;
  |     }
  |     public Gender getGender() {
  |             return gender;
  |     }
  |     public void setGender(Gender gender) {
  |             this.gender = gender;
  |     }
  |     public long getId() {
  |             return id;
  |     }
  |     public void setId(long id) {
  |             this.id = id;
  |     }
  |     public String getLastname() {
  |             return lastname;
  |     }
  |     public void setLastname(String lastname) {
  |             this.lastname = lastname;
  |     }
  | }
  | 

These are their mapping files:


  | <hibernate-mapping>
  |     <class name="net.andyleung.multimedia.mp3.entity.Gender" table="gender">
  |         <id name="id" column="id">
  |             <generator class="native"/>
  |         </id>        
  |         <property name="description" column="description" />
  |         <property name="type" column="type" />
  |         
  |         <list name="singer">
  |             <key column="id" not-null="true"/>
  |             <list-index column="gender"/>
  |             <one-to-many class="Singer"/> 
  |         </list>
  |     </class>
  | </hibernate-mapping>
  | 


  | <hibernate-mapping>
  |     <class name="net.andyleung.multimedia.mp3.entity.Singer" table="singer">
  |         <id name="id" column="id">
  |             <generator class="native"/>
  |         </id>
  |         <property name="firstname"/>
  |         <property name="lastname"/>
  |         <many-to-one name="gender" class="Gender" column="gender" 
not-null="true" update="false" insert="false"/>
  |         <!--
  |         <many-to-one name="country" class="Country" column="country" 
not-null="true" update="false" insert="false"/>
  |         <list name="album">
  |             <key column="singer" not-null="true"/>
  |             <list-index column="singer"/>
  |             <one-to-many class="Album"/> 
  |         </list>-->
  |     </class>
  | 
  | </hibernate-mapping>
  | 

But somehow it says my Singer is mapping incorrectly.  Any clue?

Thanks.

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

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


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to