The relationship between the User entity and UserType etity is as follows:
1 User can only have 1 UserType, but 1 UserType can belong to many Users. Furthermore, User maintains a reference to UserType, but UserType does not have a reference to User. So in ejb-jar.xml, we have defined the one-to-many unidirectional relationship between the UserEJB and the UserTypeEJB is as follows:
I have also added the following to jbosscmp-jdbc.xml:
However, when the inserting the above xml fragment into jbosscmp-jdbc.xml, I get an error saying that there is no ejb-relationship-tag-name element. I do not know the reason for this, as I have followed the dtd for jbosscmp-jdbc.xml, and confirmed that the ejb-relationship-role-name tags match in both jbosscmp-jdbc.xml and ejb-jar.xml.
Another modification I have tried is removing the relationships tag altogether from jbosscmp-jdbc.xml. This allowed me to deploy my beans. I also added the following cmp-field to the 'user' entity in jbosscmp-jdbc.xml:
This xml fragment is in jbosscmp.xml. The result of this is that there is a field called utl in the user_types table in the database. But the value being inserted into this field is not the foreign key integer id of the user_types table, but a serialized version of the UserTypeEJB.
Please advise on the following issues described above:
1. no ejb-relationship-role-name defined error.
2. serialized UserType being stored in RDBMS table users, instead of foreign key integer.