-->
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.  [ 4 posts ] 
Author Message
 Post subject: hibernate-reveng: problems with many-to-many
PostPosted: Thu Feb 15, 2007 9:55 am 
Newbie

Joined: Mon Feb 12, 2007 10:06 am
Posts: 3
DB: Oracle 9i
Hibernate Tools: 3.2.0beta8
JBoss 4.0.4

Hi!

When i start the jboss after reverseengineering i get the following error:

Code:
org.hibernate.AnnotationException: Illegal use of mappedBy on both sides of the relationship: stiwa.zde.persistence.model.AdTimebooking.adTeleworks


I have following db situation:
- Table adTimebooking
- Table adTelework
- Table rt_timebooking_telework (join table), where there are only the two id-columns which identifies the composed primary key. Additional they single attributes are foreign key to the other two tables.

Two java-classes and xml-files were generated (not for the relation-table!).

The code-situation:

Timebooking:
Code:
@ManyToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="adTimebookings")
    public Set<AdTelework> getAdTeleworks() {
        return this.adTeleworks;
    }

Code:
<set name="adTeleworks" inverse="true" table="RT_TIMEBOOKING_TELEWORK">
            <key>
                <column name="TIMEBOOKINGID" precision="20" scale="0" not-null="true" />
            </key>
            <many-to-many entity-name="stiwa.zde.persistence.model.AdTelework">
                <column name="TELEWORKID" precision="20" scale="0" not-null="true" />
            </many-to-many>
        </set>


Telework:
Code:
@ManyToMany(cascade={CascadeType.ALL}, fetch=FetchType.LAZY, mappedBy="adTeleworks")
    public Set<AdTimebooking> getAdTimebookings() {
        return this.adTimebookings;
    }


Code:
<set name="adTimebookings" inverse="true" table="RT_TIMEBOOKING_TELEWORK">
            <key>
                <column name="TELEWORKID" precision="20" scale="0" not-null="true" />
            </key>
            <many-to-many entity-name="stiwa.zde.persistence.model.AdTimebooking">
                <column name="TIMEBOOKINGID" precision="20" scale="0" not-null="true" />
            </many-to-many>
        </set>


How can I solve this problem (to get a correct file generation)?
I read this bug was found in former hibernate-tools-versions... now fixed at the current beta?


Thanks, Bernie


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 10:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
not fixed yet - sorry about that.

best known workaround is to have a custom revengstrategy that selects which of the sides that gets inverse="false"

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 16, 2007 3:09 am 
Newbie

Joined: Mon Feb 12, 2007 10:06 am
Posts: 3
How can I manipulate my reveng.xml-file to disable the inverse-property for the concerned table 'adTelework'?


Code:
<hibernate-reverse-engineering>
???
</hibernate-reverse-engineering>


I'm new with Hibernate, please help (with an example)

Bernie


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 16, 2007 4:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you will have to write a custom reverse engineering strategy that does the right thing (not possible via reveng.xml yet).

p.s. if you are new with hibernate I would start by doing things more by hand instead of letting a tool reverse engineer things for you - just a friendly advise.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.