Hibernate version: 3.1.2
planned
JBoss version: 4.0.3sp1
Name and version of the database you are using: MySQL 5.0
We are building a web app and I would like to use OSiV for lazy loading in the presentation layer. I have already read and think I understand:
http://www.hibernate.org/42.html
http://www.hibernate.org/43.html
My current plan is to use a single session for both the presentation layer and business layer, but use two (or more) transactions. This would be:
* one (or more) txns for business operations
* one read-only txn for resolving lazy refs in the presentation layer
My current understanding is that using OSiV implies co-locating the presentation layer and business layer on the same JVM/server (or tier of servers). This has the benefits of sharing the session cache and easy lazy loading, but (presuming we've chosen this architecture for the right, requirements-based reasons) the organizational disadvantage of convincing CTOs that Tier-per-Layer is not the only way to build "enterprise" apps.
Is the above correct?
If I was to attempt to lazy-load in the presentation layer AND deploy the presentation layer and business layers to separate physical tiers (or separate JVMs) then I would have to open a separate session for each tier, eliminating the benefits of a shared session cache and, possibly worse, missing flushed updates from the business layer (if my presentation session was opened prior to the business invocation). This seems to be more work and less performant than simple eager loading from the business tier.
Am I thinking about this correctly? Is OSiV with distributed deployment a realistic option?
Thanks. --Dan