-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem with @ManyToMany from JDBC Reverse Eng. (3.2beta8)
PostPosted: Tue Oct 17, 2006 10:51 am 
Newbie

Joined: Mon Jul 17, 2006 2:13 pm
Posts: 8
Location: Paris
Hi all,

First of all, congratulations for this great piece of work that I am just beginning to fully appreciate.

I tried running a JDBC reverse engineering on our DB model, using Hibernate Tools 3.2beta8 (within Eclipse 3.2.1), with an Oracle 10g db (Oracle9Dialect).

I got a pretty good result, except a nasty error that breaks the start of the HibernateUtil, related to two tables with a join table between them (ManyToMany relationship):

_________________________________________________________
16:38:38,083 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.ExceptionInInitializerError
at test.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:25)
[...]
Caused by: org.hibernate.AnnotationException: Illegal use of mappedBy on both sides of the relationship: test.model.Offer.globalOffers
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:175)
at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass(CollectionBinder.java:1023)
at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass(CollectionBinder.java:886)
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:527)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:468)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1049)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1205)
at test.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:20)
__________________________________________________________


I do understand that I should choose a "side" and not have mappedBy arguments on the two sides, but how can I configure it in the reveng.xml ?
I've browsed the web and forums, but I've not found any way to do it (:-((

Thanks for any help!

--Eric


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 1:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
current version has a problem with many-to-many and annotations.

workarounds are either disable many-to-many detection
or go in and remove one of the mapped by attributes.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 1:26 pm 
Newbie

Joined: Mon Jul 17, 2006 2:13 pm
Posts: 8
Location: Paris
Thank you Max for your insight.

Is there some syntax planned for the reveng.cfg.xml, since I guess it is not obvious to know which one to suppress? Or may be there is some better strategy.

Do you think it will be fixed for the H.Tools CR?

Thanks again,

--Eric


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 1:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i will at least make the reverse engineering avoid doing double mapped-by for many-to-many.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 1:58 pm 
Newbie

Joined: Mon Jul 17, 2006 2:13 pm
Posts: 8
Location: Paris
Sounds great. Thanks Max!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.