- This topic has 5 replies, 2 voices, and was last updated 17 years, 4 months ago by volkanc.
-
AuthorPosts
-
volkancMemberI am using myeclipse to generate compositeid but I cant sort out the problem in the code. It requires me to create a GroupMemberId class but it is only include composite id. Should I do it?
I am getting error message
An association from the table GroupMember refers to an unmapped class: GroupMemberId.thanks for any help…
<hibernate-mapping>
<class name=”GroupMember” table=”groupmember”>
<composite-id name=”id” class=”GroupMemberId”>
<key-many-to-one name=”groupid” class=”Group” column=”groupid”/>
<key-many-to-one name=”memberid” class=”Member” column=”memberid”/>
</composite-id>
</class>
</hibernate-mapping><hibernate-mapping>
<class name=”Group” table=”group”>
<id name=”id” type=”java.lang.Integer”>
<column name=”id” />
<generator class=”increment”></generator>
</id>
<property name=”name” type=”java.lang.String”>
<column name=”name” length=”45″ not-null=”true” />
</property>
<property name=”status” type=”java.lang.Short”>
<column name=”status” not-null=”true” />
</property>
<many-to-one name=”member” column=”memberid” not-null=”true”>
</many-to-one>
<set name=”groupposts” inverse=”false”>
<key column=”groupid”/>
<one-to-many class=”GroupPost” />
</set><list name=”groupmembers” table=”GroupMember”>
<key column=”groupid”/>
<list-index column=”memberid”/>
<composite-element class=”GroupMember”>
<many-to-one name=”id” column=”memberid”/>
</composite-element>
</list>
</class>
</hibernate-mapping>
volkancMemberI think it need GroupMemberId.hbl.xml and shoudl be mapped in the hibernate.cfg.cml
but as I said it is declared in the GroupMember as compusite key and defined class name…
Riyad KallaMembervolkanc,
Are you using MyEclipse to rev-eng all the tables involved and you are saying it’s not generating one of the classes?I wasn’t really clear on what is going on, what your setup is, etc.
volkancMemberyes I am using MyEclipse to rev-eng. I asked the question in hibernate forum and search on the net I changed a bit but still don’t work…
then I added id column finally it works but it seem very strange. first column generate auto number which is totaly unnecessary in a composite table.
Riyad KallaMemberHmm that is strange. I will make a note of it for our developers to look into. Thank you for bringing this to our attention.
volkancMemberthanks
-
AuthorPosts