Hi,
We have done the (almost) same move
for our many Seamv2/JSFv1.2/RFv3.3/JPA-Hibenate-WebSphere v7.0
applications to CDIv1/JSF2.0/Primefacesv4/JPA-Hibenate-/WebSpherev8.5.5
and we faced the same questions you are asking
As you probably already know, most of what makes Seam 2 so great is now part of CDI and JSF 2.0, but unfortunately not all.
For
the missing parts, Seam 3 was not an option (code being merged to DS)
and we tried to "fill the gaps" with CODI (that is being merged into DS)
and the still-in-development-DetaSpike project but, after many
so-called "migration proof of concepts" we finally decided to just build
our own "CDIUtils" library with the missing parts, with code borrowed from CODI,
DS and omnifaces.
DS is a great framework but it does not really fits
with our needs (Do lots of thing we don't need and do other thing in a
way we don't like, as the "Strong typed navigation model/paradigm)
Our
applications are all composed of many module: 1 JPA jar, 1 EJB module, a
WAR (Contains no Java except Primefaces related artefacts) , a
"UnitTest" jar and eventually a batch jar. The EJB at high level
contains "Page Controllers (Mostly SFSB or POJOs)", "Managers (SLSB)",
MDBs and Web Service endpoints (SLSB).
Our CDIUtils lib is composed of 7 jars:
-
base jar with CDI components to manage property files, JSF Messages +
AJAX-aware JSF 2.0 exception handler (thanks to omnifaces),
Entity+Rollback CDI comp producers, JSF v2.0 locale, a CDI PageContext
(=JSF ViewContext assignable to producer), super classes for Controlers,
Managers, WebServices and batches and a few other goodies..
-
batch: with classes to bootstrap weld-se and CDI alternatives to
EntityManager and Rollback providers, and alternatives to non-se
contexts (Request, Conversation..)
- jpa: depends on hibernate with a dedicated DB2 Dialect
-
security: depend on Apache Shiro: Shiro-CDI integration that expose 2
interfaces to application : authentication adn registry management
-
pdf: depends on the FOSS version of iText, Cloned from the Seam 2 PDF
facelets tags + a CDi component to render Facelets with PDF tags
programatically
- WebSphere: depends on WebSphere, with the Hibernate JTA provider and second level cache implementation
-
test: depends on junit and selenium with a CDIfied Junit4Runner and CDI
alternatives to EntityManager and Rollback providers, and non-j2se
contexts (Request, Conversation..)
It seems to be a lot of code, but in reality it is not. It just exposed the missing artefacts that were in Seam 2, not in JSF 2.0 and CDI
In a few words, we don't have any more a pages.xml nor components files and we do not depends on external CDI related libs :
- Transactions are managed by the EJB Container itself
- JPA/HIbernate session are managed by our EntityManager CDI producer + an @AroundInvoke
annotated method in our Ctrl+Manager+MDB+batch superclass that attach
the em at each EJB method call and so solve the (in-)famous "Hibernate lazy
instantiation exception" solved by Seam 2 in its time
- Seam 2 security is replaced by by Apache Shiro with a nice shiro.ini file that is similar to pages.xml for this
- Seam 2 PDF is replaced by our own lib
- thanks to JSF 2.0, navigation is done directly with the name of the page without teh need to pages.xml file
- CDI basic conversation management is enough for us, so we use it. We had to replace Seam 2 outjection, it's just a different way on thinking on CDI..
-
The EntityManager producer was a bit tricky to create because it must
work in SFLB, SFSB, MDB, J2SE... and due to CDI contexts, but it now work great
- We use weld for junit/batch even if WAS comes with a modified version of OWB because of some bugs in different interpretation of CDI
- Moving from RichFaces to Primefaces was not so difficult and -this is our perception- easier to use
I
know this does not exactly answer your question but I thought that it
may be intersting for you to share our experience how we are moving out
from Seam 2 and I'm concisous that our situation may be different from
other (Usage of EJB ..)
If you need more details, I
will be happy to share them. On some days I'm thinking about writing
somewhere what we did to migrate and eventually share our "CDIUtils"
source code (ie create an open source project) lib but I'm not sure that
that code is "universal" enough for that
Cheers
Denis