-->
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: Compelling use case to ignore TransientObjectException???
PostPosted: Wed Nov 10, 2004 5:28 pm 
Regular
Regular

Joined: Tue Dec 09, 2003 2:39 pm
Posts: 106
Location: Toronto, Canada
Hi gang,

We have some legacy business logic that we are migrating into our current applications domain.

This new domain is made up of a very rich set of POJO domain objects. The legacy system used a custom home grown persistence layer circa the late 90s.

The business logic in question will manipulate the persistent objects within the context of a transaction. However, we do not want any of the changes to the domain objects to be persisted at the end of the transaction. This is simply runtime manipulation of the domain objects that we want to discard prior to the end of a transaction.

Is there a graceful way of doing this without introducing some parallel class hierarchy (ala DTO or some evil cousin)?? We currently catch, log a warning for transient exceptions, and then ignore at the end of the transaction.

A crude pseudo example of what we are trying to accomplish:

1) Transaction is open
2) Persistent domain object A is load into memory
3) Domain logic modifies property B of object A
4) Domain logic creates a transient domain object C and associates it with A
5) Transaction is closed

If we were to open another transaction and find domain object A, we'd like to see it in its original state prior to step 3.

Is there a way to do this without walking our modified graph of objects, dereferencing transient objects and deleting them (or have JVM garbage collect them)? Or is it simply good enough to just ignore transient exceptions?

Regards,
Roll


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 09, 2005 1:53 pm 
Regular
Regular

Joined: Tue Dec 09, 2003 2:39 pm
Posts: 106
Location: Toronto, Canada
Just looked at this old post I made. What we ended up doing was to set the flush mode to NEVER on the session. Cheers.


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.