-->
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: Hibernate DAOs Standalone
PostPosted: Tue Nov 22, 2005 3:55 pm 
Newbie

Joined: Tue Oct 11, 2005 5:55 am
Posts: 8
This thread is actually a continuation of the following topic:

Hibernate DAOs Standalone vs. J2EE Environments http://forum.hibernate.org/viewtopic.php?t=946551

i started a new thread so that i can hand out a few credit points, since
i would really need to understand this asap...

----------------------

i am currently trying to combine christians "Generic DAO pattern with
JDK 5.0" with a standalone application. since the usage of servlet-filters
isn't possible and because i would also like to avoid using spring, the proxy
method mentioned in the thread (above) seems to be the only other
possibility.

i am using hibernate 3.1rc3, so that i can set the "current_session_context_class"
configuration option to "thread" in order to use the ThreadLocal feature.

i do understand, that this creates a new session if none is available, but
how and where do i write the transaction demarcation code as well as the
code for closing the session, if this doesn't belong into the DAOs.

i need something between my application code and the DAOs to decouple the
application from the hibernate framework and the transaction code altogether.
one solution mentioned would be AOP, which i would like to avoid.

the "proxy" method sounds promising! has anybody done this and could give
me (a confused newbie) a quick explanation...

thanks,
nick



Hibernate version:
hibernate 3.1rc3

mysql 5
The generated SQL (show_sql=true):


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 6:14 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
I quote from the page I've given you a link to already...

Finally, a very flexible approach is AOP, where interceptors can be applied to anything in your Java application. For an example have a look at the CaveatEmptor demo application.

http://caveatemptor.hibernate.org/

Get the CVS, look into TransactionInterceptor, jboss-aop.xml, and build.xml for load- or runtime weaving.


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.