Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate Tools v3.0.0 alpha4a
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="dao.hibernate.mysql.Term" table="term" >
<id name="termid" type="integer">
<column name="termid" />
<generator class="assigned" />
</id>
<property name="name" type="string">
<column name="name" length="50" not-null="true" />
</property>
<set name="conceptterms" inverse="true">
<key>
<column name="termid" not-null="true" />
</key>
<one-to-many class="dao.hibernate.mysql.Conceptterm" />
</set>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="dao.hibernate.mysql.Concept" table="concept" >
<id name="conceptid" type="integer">
<column name="conceptid" />
<generator class="assigned" />
</id>
<property name="name" type="string">
<column name="name" length="50" not-null="true" />
</property>
<property name="description" type="binary">
<column name="description" />
</property>
<property name="externalid" type="string">
<column name="externalid" length="50" not-null="true" />
</property>
<set name="conceptterms" inverse="true">
<key>
<column name="conceptid" not-null="true" />
</key>
<one-to-many class="dao.hibernate.mysql.Conceptterm" />
</set>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="dao.hibernate.mysql.Conceptterm" table="conceptterm" >
<id name="concepttermid" type="integer">
<column name="concepttermid" />
<generator class="assigned" />
</id>
<many-to-one name="term" class="dao.hibernate.mysql.Term">
<column name="termid" not-null="true" />
</many-to-one>
<many-to-one name="concept" class="dao.hibernate.mysql.Concept">
<column name="conceptid" not-null="true" />
</many-to-one>
</class>
</hibernate-mapping>
Name and version of the database you are using:
MySQL 4
Hi,
I have a many-to-many association for the tables "concept" and "term" with a association table called "conceptterm".
When using the tool to generate hibernate mappings, it generates POJOs for each table including the association table and treats the associations between tables conceptterm and concept as many-to-one and between conceptterm and term as many-to-one. I understand that this is the default behavior.
Is there a way to tell the tool upfront that about association tables (such as table "conceptterm" above) so that the mappings are generated with fetch="join" and so that the association table does not get its own POJO?
Thanks.