-->
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.  [ 1 post ] 
Author Message
 Post subject: problem removing reverence from object
PostPosted: Tue Aug 29, 2006 6:23 am 
Newbie

Joined: Mon Aug 07, 2006 2:44 am
Posts: 8
Hibernate version:3.1

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

i have 2 entity with @ManyToMany reference:
Quote:
@Entity
@Table(name = "tblCart")
public class Cart extends IDEntity {
private Collection<File> items = new ArrayList<File>();

@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
public Collection<File> getItems() {
return items;
}
....
@Transient
public void removeItem(File file) {
items.remove(file);
}


File doesn't have reference to Cart.

when i performs:
Quote:
Cart cart = ..retrieving..
File file = ..retrieving..
...
session.flush();
session.clear();
session.beginTransaction();
cart.removeItem(file);
session.merge(cart);
session.getTransaction().commit();


it doesnt change db... in log i see:

The generated SQL (show_sql=true):
Hibernate: delete from tblCart_tblFiles where tblCart_id=?
Hibernate: insert into tblCart_tblFiles (tblCart_id, items_id) values (?, ?)

WHY?? what can i do to avoid this?


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

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.