Rick has posted 25 posts at DZone. You can read more from them at their website. View Full User Profile

Announcing Apache Orchestra, JSF conversation scope without Seam

02.20.2008
| 11294 views |
  • submit to reddit

Apache Orchestra was released Oct. 2007 without much fanfare. The announcement simply stated: "Apache MyFaces Orchestra is a library which introduce a new scope called 'conversation scope' to your web based application which will help you alot (sic) building applications using ORM by avoiding exceptions like LazyInitializationException."

Orchestra builds on top of Spring's support for scopes to build the new conversation scope. It seems you can create an extended persistence context to avoid LazyInitializationException and such. According to the site, Orchestra works with TopLink and OpenJPA as well. There is a small code example here.

There are some who find JBoss Seam a bit much to swallow and use Apache Orchestra to fill in some of the gaps. For others Orchestra builds on top of their investment in JSF and Spring without including yet another framework.

Last March we were deciding whether or not to use JSF and Seam for a project. The head architect decided on JPA, JSF and Spring, but decided to only use Seam later if we really needed it as we already had a lot to digest.

Now we have a few use cases where we could really use a conversation scope. Shortly, we have to decide on whether we should use Orchestra or Seam. We already use JSF, Spring, and JPA. Any suggestions?

What has been your experience with Apache Orchestra? When would Apache Orchestra not fit and the project need the full power of Seam? When could you get away with just Apache Orchestra? Does Seam make sense for a Spring shop?

Related post:

Seam 2.0.1 released, Is Seam or Spring the best way to write JSF/JPA based applications?



About the author

Rick Hightower is CTO of Mammatus and is an expert on Java and Cloud Computing. Rick is invovled in Java CDI advocacy and Java EE. CDI Implementations - Resin Candi - Seam Weld - Apache OpenWebBeans

Published at DZone with permission of its author, Rick Hightower.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Rainer Eschen replied on Wed, 2008/02/20 - 4:44pm

Using your Crank in a BO/DAO context we also get LazyInitializationException from time to time. We already have workarounds for this through explicit loading of POJOs.

Having a look at the example at the Orchestra homepage for me this is a lift up of the transactions from the BOs into the presentation layer. I wonder if this is really an advantage or merely a violation of "separation of concerns"?

Jeremy Grelle replied on Thu, 2008/02/21 - 10:53am

While I do think Orchestra is a nice implementation of the extended persistence context pattern for Spring + JSF, I would like to point out another candidate to the list of alternatives to Seam for developers who are more comfortable with Spring.

We (the Spring team) actually feel that Spring Web Flow 2.0, with its upcoming RC1 release, is the optimal solution for using the extended persistence context pattern with JSF, and for Spring + JSF development in general, especially with the addition in SWF 2.0 of the Spring Faces module. SWF 2.0 has support for a flow-managed persistence context using either standard JPA (not using any Hibernate-specific extensions) or native Hibernate. SWF 2.0 does also provide custom Spring 2.x scopes so that Spring beans can be defined with the SWF-specific flash, flow, and conversation scopes. Spring Faces started as a completely fresh take on the integration between SWF and JSF, and has further evolved to include a large number of additional features to make JSF development in a Spring environment feel easier and more natural. Keep an eye out for the RC1 release as there will be a lot more information to follow.

Rick Hightower replied on Thu, 2008/02/21 - 12:56pm in response to: Jeremy Grelle

Thanks Jeremy. I will take a look.

Shay Shmeltzer replied on Thu, 2008/02/21 - 1:10pm

One more option that will let you achieve a process type of scope is to use the Apache Trinidad components (or the Oracla ADF Faces components).

While Trinidad is mostly knows for the fact that it offers over a 100 JSF components, it also comes with some core framework capabilities. And one of those is the process scope which is called pageFlowScope in Trinidad.

See the documentation here - part of the Trinidad Developer Guide.

 

Jim Hazen replied on Thu, 2008/02/21 - 9:58pm

Seam doesn't have the following limitation.

http://myfaces.apache.org/orchestra/index.html
Orchestra persistence features presume the presentation tier has access to the database, i.e. that the presentation and database-access tiers are combined. This is often the case in small-to-medium web applications. Large or security-sensitive applications which separate database access out into an isolated tier (eg use a "full EB stack") cannot use the Orchestra persistence facilities, although they can still make use of the regular conversational support for beans in the presentation layer.

Just browsing the Orchestra docs briefly...

Seam appears to support a few more things Orchestra doesn't:

  • Much richer conversation demarcation including:
    • Starting conversations on GET requests
    • Annotation based demarcation on service methods
  • Nested conversations
  • Named conversations along with a switcher component
  • Natural IDs for conversations
  • Rich JSF component support for conversation management
  • Conversation support for jPDL pageflows
  • Good Documentation

And of course there are more reasons to try Seam than just conversations. With Seam's transparent Spring support you don't have to choose Seam or Spring. If you've already started with Spring, try rolling in some Seam. If you want to use Orchestra or SWF later on you're free to mix those in as well.

Rick Hightower replied on Sat, 2008/02/23 - 2:40am in response to: Jim Hazen

As always Jim... it is good to hear from a good friend. Thanks for the info on Seam. Seams seems to have quite a lot of features. There is a lot to learn. How easy is it to work with Seam and Spring? In your opinion....

Seam adoption is a bit weaker than I would imagine. Do you suppose it is becuase... early on Seam hitched their wagon to EJB3 and was sort of billed as the anit-Spring? It seems at first it did not have much support for Spring.

Seam is a little long in the tooth not to get more job demand. In fact, you can almost attribute its real growth to when is added support for Spring. (Just an opinion...)  So now that it has support for Spring.... I guess there is nothing holding me back...

I am glad it has solid integration with Spring. I know we are running into some use cases where Seam, Orchestra or possibly SWF could help out. My brain is already full with JSF, JPA and Spring... one more framework and it will implode.... just another thin mint.

 

Rick Hightower replied on Sat, 2008/02/23 - 2:47am in response to: Rainer Eschen

That is pretty much what we do as well.... Thinking about using Seam, Orchestra and/or Seam so this is an option instead of a need.... Good to hear from you Rainer...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.