-->
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: No unique constrain on cascade-all children?
PostPosted: Wed Nov 17, 2004 10:57 am 
Newbie

Joined: Sat Nov 13, 2004 8:09 am
Posts: 14
Location: Hamburg
Hibernate version:2.1.6

Hi. I have a one-to-many mapping between World and Country with cascade="all-delete-orphan". In Country exists a property with a unique="true" constrain (String identifier). When I use the cascade-save mechanism, no exception is thrown when the identifier already exists. When I save the object explicitly, it works as expected.
A bug???
Do I have to save all objects with session.save() to ensure data integrity?

Example:
Does NOT throw an exception
Code:
world = (World)s.load(World.class,world.getId(),LockMode.UPGRADE);
Country country = new Country();
country.setIdentifier(identifier);
world.addCountry(country);


Does throw an exception
Code:
world = (World)s.load(World.class,world.getId(),LockMode.UPGRADE);
Country country = new Country();
country.setIdentifier(identifier);
world.addCountry(country);
s.save(country);


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.