-->
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: How can I auto delete all created entities in the VM.
PostPosted: Sun Sep 30, 2007 6:23 am 
Newbie

Joined: Sun Sep 30, 2007 6:10 am
Posts: 2
Hi,

I want to increase the performance of my integration tests. The servlet engine is run in the same VM as the tests. This means that I have a main thread, with a Session bound to it, inserting test data upon setup. It also means that I will have Servlet worker threads creating data in other Sessions in response to actions (directed by selenium) on the front end.

I am planning to register a HibernateEventListener for at least the events "save" and "save-update", when an object is persisted I would store a reference to this in a thread safe "Test context" class. Upon tearDown() I would then iterate through the objects and call Session.delete() from the main thread. Of course, the objects created from the worker threads in the app, will not necessarily be known to the Session in the main test thread.

I'd really appreciate some comments on this strategy, I am fairly new to hibernate (using it for 6 months, read the manning book etc), but this is straying to the edge of my knowledge and would appreciate some guidance from some of you Hibernate Ninjas out there :-)

All the best, Jonthan


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 8:45 pm 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
HI!

Never tried, but what about using the HQL and Polymorphics?

http://www.hibernate.org/hib_docs/v3/re ... lymorphism

delete from java.lang.Object o

Regards,
Pavol


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.