Apache MyFaces Orchestra
July 2, 2007 2 Comments
JSF-Spring-Hibernate is a popular formula these days but the inconsistency between the view layer and persistence layer can be a pain in the ass. A real life example is my previous project where we’ve used OpenSessionInViewFilter of Spring which basically binds a session to a request by a filter. Then the developers in the team started to get these damn LazyInitializationException or NonUniqueObjectException errors in workflow scenarios, the reason was simple. In a request you load a persistent object and put it in somewhere like HttpSession or JSF ViewState where you can get it in further requests. The thing is; accessing an uninitialized lazy object property in another request later will cause lazy exceptions. Workarounds can be doing Session.merge() and bind the detached object to the current request but trying to maintain the synchronization of the object in each request does not sound a good idea. The real solution would be using long persistence contexts.
Apache MyFaces Orchestra is a subproject of Apache MyFaces family and tries to solve this problem with the view layer and persistence layer. It has a simple conversation api that can be used in workflow scenarios. The backing beans are not managed by JSF but spring so it can use aop tricks and custom scope functionality(JSF 2.0 will have these too hopefully).
After you read this, you’ll probably compare it with Seam, well Seam tries to solve the same problem too but also adds many more goodies to your application. If you’re using Spring I’d suggest trying Orchestra to take care of your view-persistence layer problems in workflow scenarios, on the other hand if you’ve preferred EJB3 over spring, Seam can be handy too.
Apache MyFaces Orchestra Links