-->
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: Basic Hibernate Question
PostPosted: Fri Oct 27, 2006 9:52 am 
Newbie

Joined: Tue Oct 24, 2006 4:40 pm
Posts: 3
Hello,

My problem is

I have 2 beans let's say A and B, they are related with an "has one or many" relation. So A has one or many B's.

When I manipulate A (with the getters and setter) without saving it into the database.

code:

A.setName("test");

When i try do delete a B of A hibernate automaticly updates A. How can I disable this function.

B b = A.getBs().get(0);
HibernateUtil.delete(b);

SQL ->
update A (I don't want this)
Delete B

Thx in adv,
Pieter


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 10:30 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
ehh, not sure you can. Hibernate likes to persist the changes to the database.

Try calling delete on the B object by itself and removing any references to the parent and removing the reference in the parent collection to that B object.

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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.