-->
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: Persist partial collections based on condition in hibernate
PostPosted: Sun Dec 04, 2011 5:58 pm 
Newbie

Joined: Fri Oct 28, 2011 12:55 pm
Posts: 3
Hi All,

Is it possible to persist an object using hibernate mappings, only if certain condition on the object property is true and the condition is specified in hibernate config? This requirement comes from persisting partial entries of a collection using hibernate.
I have the following example. Lets say we have Event Object that has reference to collection of EventTypes.
class Event
{
int eventId;
List<EventType> eventTypes;
}

class EventType
{
int eventTypeId;
boolean isPublisherEvent;
//other eventtype properties
}

When calling hibernateTemplate.save(event), I would like to store only those EventTypes that have isPublisherEvent=true. I looked at hibernate filters and HQL, but the extra conditions are applied only during querying of tables, and not during persist/save. Is there anything else in hibernate that I could use to solve this.

Thanks
Malay


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.