-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate-Middlegen and many-to-many relationships
PostPosted: Wed Dec 15, 2004 3:54 pm 
Newbie

Joined: Wed Dec 15, 2004 3:52 pm
Posts: 2
Hey,
ive been using middlegen to generate my mapping files. It works great. It generates a mapping for all the tables in my schema (approximately 20 tables) . Except when I added the following

<many2many>
<tablea generate="true" name="MERCHANTS" />
<jointable name="GROUPS_MERCHANTS" generate="false" />
<tableb generate="true" name="GROUPS" />
</many2many>

After I added this many-to-many restraint, all the other tables in my schema (except groups and merchants) disappeared. The middlegen view now only shows 2 tables!! This is what my ant task looks like:

<target
name="mymiddlegen"
description="Run Middlegen"
unless="middlegen.skip"
depends="init,fail-if-no-xdoclet-1.2,check-driver-present,panic-if-driver-not-present"
>
<mkdir dir="${build.gen-src.dir}"/>
<echo message="Class path = ${basedir}"/>

<taskdef
name="middlegen"
classname="middlegen.MiddlegenTask"
classpathref="lib.class.path"
/>

<middlegen
appname="${name}"
prefsdir="${src.dir}"
gui="${gui}"
databaseurl="${database.url}"
initialContextFactory="${java.naming.factory.initial}"
providerURL="${java.naming.provider.url}"
datasourceJNDIName="${datasource.jndi.name}"
driver="${database.driver}"
username="${database.userid}"
password="${database.password}"
schema="${database.schema}"
catalog="${database.catalog}"
>

<many2many>
<tablea generate="true" name="MERCHANTS" />
<jointable name="GROUPS_MERCHANTS" generate="false" />
<tableb generate="true" name="GROUPS" />
</many2many>

<!-- Plugins -->
<hibernate
destination="${build.gen-src.dir}"
package="${name}.hibernate"
javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
/>

</middlegen>
<mkdir dir="${build.classes.dir}"/>
</target>

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 15, 2004 6:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Middlegen currently only displays tables that are included in the XML or all tables if not in the XML. The bad part is Man-tio-Man definitions puts it into the Table tags mode. This will change. Solution, add the rest of the tables into the Ant script using the table tag.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.