-->
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: correct joining of manyToMany association table
PostPosted: Fri Dec 15, 2006 4:45 am 
Newbie

Joined: Mon Aug 07, 2006 2:44 am
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2ga

Full stack trace of any exception that occurs:

Name and version of the database you are using:mysql 5

two entities associated as manytomany

@Entity
public class Subject{
...

@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "SubjectLinkedToCalendar",
joinColumns = {@JoinColumn(name = "idSubjectFK")},
inverseJoinColumns = @JoinColumn(name = "idCalendarFK"))
public Set<Calendar> getCalendars() {
return calendars;
}
}

@Entity
public class Calendar{
....

@ManyToMany(cascade = CascadeType.REMOVE)
@JoinTable(name = "SubjectLinkedToCalendar", joinColumns = {@JoinColumn(name = "idCalendarFK")}, inverseJoinColumns = @JoinColumn(name = "idSubjectFK"))
public Set<Subject> getSubjects() {
return appointments;
}
}

maybe i made wrong joinTable mapping i don't know but it sucessfully works with persist , merge, delete, etc. operations
but don't handles bu transactions:
this means when i removing some subject.. associations to calendar are removings too.. but if i make transaction.rollback()
everything is rollbacks except SubjectLinkedToCalendarTable
(so i have database damage)

help please..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 6:57 am 
Newbie

Joined: Mon Aug 07, 2006 2:44 am
Posts: 8
maybe there are some mechanizms for controlling transaction flow?
i mean maybe i can specify explicitly rollbacking of concrete table..

or i should search solutions in mysql bugs ?)

..its abnormal to "forget" to rollback one table during transaction :(


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.