I'm involved with a legacy web app project using Java 5, Struts 1.x,
JSF 1.1, Hibernate 2, Spring 1.x, some EJB2s and more. Orchestra has
caught our eye as way to do some refactoring to take full advantage
of Hibernate's lazy-loading across a series of requests. (A
conversation, of course.)
I got the Orchestra examples running with Hibernate 3, did a very
simple app of my own design, and I think I've got some understanding
of the Orchestra core machinery.
The next question is this: What's the best way to integrate Orchestra
with our existing app? We have a fairly significant investment in
DAOs written to the Hibernate API so if we could avoid rewriting
those to use JPA, that'd be great. If we could reuse our existing
Hibernate mappings in XML, that'd be great, too. We're not averse to
moving to Hibernate 3, and Spring 2 seems like a no-brainer.
The Orchestra installation page has a tantalizing sentence: "The
installation guide will show you how to setup a JPA entity manager
..., later a chapter explaining how to access Hibernate directly will
be added." Would there be a chance of getting a quick sketch of
what's involved in accessing Hibernate directly?
It seems that having a HibernatePersistenceContextFactory, an analog
of JpaPersistenceContextFactory, might go a long ways. I Googled for
that and found such a class on Mario's blog. I dropped that in to my
trivial app and adjusted the related objects but the first database
access fails with "Session is closed!" I see that a fellow named
Michael Marr got it working; a note to him is on my todo-list for tomorrow.
Has anybody else had luck with HibernatePersistenceContextFactory?
Any comments/ideas about how we might fit Orchestra into our app will
surely be appreciated.
Best regards,
William Mitchell
Mitchell Software Engineering