-->
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: associate table using: set table="xyz"
PostPosted: Sat Dec 17, 2005 3:12 pm 
Newbie

Joined: Sat Dec 17, 2005 1:08 pm
Posts: 5
Hibernate version:
3
Mapping documents:

<hibernate-mapping package="org.data">
<class
name="Projects"
table="projects"
>
...

<set name="modules" table="projectmodules" lazy="false" cascade="all">
<key column="pid"/>
<many-to-many column="mid" class="org.data.Modules"/>
</set>

...
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

saveOrUpdate, update

Name and version of the database you are using:

mysql 4.1

Issue:

When code calls update with a Project object where modules set has been updated, the debug log shows the Module table is being updated. I need to make sure the projectmodules table is updated.

I'm trying <set table="xyz"> from the documentation. I'm hoping to avoid writing a Hibernate mapping file/objects for projectmodules table, since it is just storing the association between modules and projects.

Thoughts?

-Todd


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 18, 2005 3:16 pm 
Newbie

Joined: Sat Dec 17, 2005 1:08 pm
Posts: 5
Seems to be an example straight out of the documenation in section 1.3.2. A unidirectional Set-based association.

But, the "projectmodules" table isn't being updated. I believe this is analogous to the "person_event" table


Top
 Profile  
 
 Post subject: 23.4.3. Many-to-many with shared composite key attribute
PostPosted: Mon Dec 19, 2005 7:03 pm 
Newbie

Joined: Sat Dec 17, 2005 1:08 pm
Posts: 5
It's also appears to be like "23.4.3. Many-to-many with shared composite key attribute" in the documentation.

Anyone?

It seems like people would run into this situation more often.

The way I've dealt with this in the past is to actually create a pojo for projectmembers, but felt like it was hack-ish.


Top
 Profile  
 
 Post subject: projectmodules not projectmembers
PostPosted: Mon Dec 19, 2005 7:05 pm 
Newbie

Joined: Sat Dec 17, 2005 1:08 pm
Posts: 5
I made an incorrect reference based on the orig post: "projectmembers" should have been "projectmodules" in previous post


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 20, 2005 8:55 am 
Newbie

Joined: Sat Dec 17, 2005 1:08 pm
Posts: 5
Hey Todd, it's Todd! How you doing pal?

Try removing the "cascade" attribute.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.