Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: hibernate 1.0.2.0
Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="myWindowsApplication.Project,myWindowsApplication" table="project" lazy="true">
<id name="Projectid" column="projectID" type="Int32" unsaved-value="0">
<generator class="assigned"/>
</id>
<property column="projectName" type="String" name="ProjectName" length="20" />
<set name="TernarrayList" table="users_workGroup_project">
<key column="projectID"/>
<composite-element class="myWindowsApplication.UGP,myWindowsApplication">
<many-to-one name="User" class="myWindowsApplication.Users,myWindowsApplication" column="userID"/>
<many-to-one name="Group" class="myWindowsApplication.WorkGroup,myWindowsApplication" column="workGroupID"/>
</composite-element>
</set>
</class>
</hibernate-mapping>
/////////////////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="myWindowsApplication.WorkGroup,myWindowsApplication" table="workGroup" lazy="true">
<id name="WorkGroupid" column="workGroupID" type="Int32" unsaved-value="0">
<generator class="assigned"/>
</id>
<property column="workGroupName" type="String" name="WorkGroupName" length="20" />
</class>
</hibernate-mapping>
////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="myWindowsApplication.Users,myWindowsApplication" table="users" lazy="true">
<id name="Userid" column="userID" type="Int32" unsaved-value="0">
<generator class="assigned"/>
</id>
<property column="firstName" type="String" name="FirstName" length="20" />
</class>
</hibernate-mapping>
////////////////////////////////////////////////////////////////////
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
i have 3 tables "users", "workGroup" and "project"
they join with a joint table named "users_workGroup_project"
and have a ternary association.
please describe following code about "Ternary association"
<set name="TernarrayList" table="users_workGroup_project">
<key column="projectID"/>
<composite-element class="myWindowsApplication.UGP,myWindowsApplication">
<many-to-one name="User" class="myWindowsApplication.Users,myWindowsApplication" column="userID"/>
<many-to-one name="Group" class="myWindowsApplication.WorkGroup,myWindowsApplication" column="workGroupID"/>
</composite-element>
</set>