-->
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.  [ 4 posts ] 
Author Message
 Post subject: Validating my Design
PostPosted: Fri Mar 05, 2004 11:33 am 
Beginner
Beginner

Joined: Tue Nov 04, 2003 2:31 pm
Posts: 28
Location: Florida, US
I am using Hibernate 2.1 and Sybase 12.5
Our system is a simple OLTP with applet client and minimal J2EE on the server.
Client requests will be initiating comamnds on the server. Each command will be initiated by a StatelessSessionBean and my JDBC Transactions starts here.

Our business rules are Plain Java classes. if all business rules are passed, we will persist the object(s).

The classes responsible for persistence are also a Plain Java class. But, they will get the Hibernate Session Factory created outside the scope of the transaction (FYI: FactoryLookup and DataSource lookup are done as part of the application deployment in the startup and cached - to avoid expensive JNDI lookup everytime).

Now, using the cached factory, we are creating the Hibernate Session and using the it for persistence. We are using mix'n'match approach - use Hibernate and plain JDBC, where ever it is fit.

All operations are under the CMT that was started in the Stateless Session Bean. Finally when the work is done, it CMT commits.

Are there any unpleseant surprises with the approach we are trying to follow??

Thanks
Vamsi


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 11:18 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Are you using the same connection for JDBC and Hibernate use in a single business process?
If yes, you should beware session cache consistency related to what you've done behind the back of Hibernate.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 06, 2004 2:27 pm 
Beginner
Beginner

Joined: Tue Nov 04, 2003 2:31 pm
Posts: 28
Location: Florida, US
Say there is a business use case, which involves 4 databse updates,
U1, U2, U3 and U4 in the same order.
If U1, U2 are using the Hibernate and U3 using Connection from JBoss DataSource Conn Pool, and U4 again using Hibernate,

U1
U2
session.evict(u1 and U2 objects) or session.clear()U3 (using Plain JDBC)
U4

Will the above approach work??


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 6:26 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Well I don't know the JBoss datasource but in the same CMT, JBoss probably give you the same connection it gave to Hibernate.
And this is good, it avoids 2PC.
The evict stuffs are fine (flush() before not to lose what you've done)

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.