Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hybrid persistence layer ..?

 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it allright to build a hybrid persistence layer (hibernate, cmps and bmps) in the same app?

Thanks,
ltcmelo
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as you use DataSources and let the outermost Session EJB's manage transactions, yes.

Kyle
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic