facebook

composite key error

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #274556 Reply

    volkanc
    Member

    I 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>

    #274558 Reply

    volkanc
    Member

    I 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…

    #274698 Reply

    Riyad Kalla
    Member

    volkanc,
    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.

    #274831 Reply

    volkanc
    Member

    yes 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.

    #274832 Reply

    Riyad Kalla
    Member

    Hmm that is strange. I will make a note of it for our developers to look into. Thank you for bringing this to our attention.

    #274888 Reply

    volkanc
    Member

    thanks

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: composite key error

You must be logged in to post in the forum log in