aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Hybrid persistence layer ..? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Hybrid persistence layer ..?" Watch "Hybrid persistence layer ..?" New topic
Author

Hybrid persistence layer ..?

Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401
Is it allright to build a hybrid persistence layer (hibernate, cmps and bmps) in the same app?

Thanks,
ltcmelo
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
As long as you use DataSources and let the outermost Session EJB's manage transactions, yes.

Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Roland Barcia
author
Ranch Hand

Joined: Apr 15, 2004
Posts: 181
Keep in mind though that if you mix data access code in the same transaction, that uncommitted data may be maintained in different locations.

So, if your CMP is updated and then the BMP through a stored proc (within the same transaction) for example expects to see that uncommitted data (possible if not a Serializable isolation level), you will have a problem because most containers do not push uncommited data from CMP till commit time for performence.


Roland Barcia: IBM Distinguished Engineer, CTO Mobile for Lab Services
Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401
So, if separate my app in use cases and implement the persistence layer of those use cases in different techonologies, i'm allright?

Clearing...
Suppose i have 3 big use cases in my system, if i implement
- use case 1 with CMPs
- use case 2 with hibernate
- use case 3 with jdo
and theese use cases don't interfer in each other, i don't need to worry about this kinda of transaction stuff. Am i right?

Thanks,
ltcmelo
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
So long as the transactions in each use case stay out of each others way (don't update the same tables) then yes. If they do, then all of the problems that Roland discusses must be addressed.

Kyle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hybrid persistence layer ..?