Hi!
WOW that was quick.
If you also have an exitsing ApplicationContext.xml file and an example DAO, that would help a lot. I specially dont know what object will be injected into the DAO instead of the EntityManager from the regular examples.
Ok, I took the time to setup the long awaited orchestra goodies project [1].

There you'll find a myfaces-orchestra-hibernate which consists of two modules.
* myfaces-orchestra-hibernate-core
* myfaces-orchestra-hibernate-examples

The core currently just holds the HibernatePersistencesContextFactory.
The examples module holds a VERY simple (and probaby wrong - quick-and-dirty - from the top of my head hacked) test app.

Just checkout the tree as described here [2] and do a "mvn install", afterwards cd into the examples module and call "mvn jetty:run". This will startup a local servlet container waiting on port 9090 for your browser to connect.

The simple example shows that the entities are the same between the requests which indicates an ongoing conversation and allows you to easily change their data. The Button "new Conversation" invalidates the current conversation which will start a new one immediately - resulting in new instances of the entity objects.

As you might see, the example use a simple DAO extending the HibernateDaoSupport. Wheter you use this or any other Spring way to deal with Hibernate is upt to you, also if you use the @Transactional annotation for transaction demarcation or not is up to you. Any standard Spring way should do the trick. Orchestra transparently sits in between and ensures to provide the same (Hibernate)Session for the ongoing conversation.

I hope everything is setup correctly, else come up again.

Ciao,
Mario


[1] http://code.google.com/p/myfaces-orchestra-goodies/
[2] http://code.google.com/p/myfaces-orchestra-goodies/source

Reply via email to