[jboss-dev-forums] [JBoss ESB Development] New message: "Re: Smooks problem"

Maurice Zeijen do-not-reply at jboss.com
Thu Jan 14 02:55:13 EST 2010


JBoss development,

A new message was posted in the thread "Smooks problem":

http://community.jboss.org/message/519957#519957

Author  : Maurice Zeijen
Profile : http://community.jboss.org/people/mzeijen

Message:
--------------------------------------------------------------
I see that you are using the Persistence cartridge to persist the PersonAge pojo into the database using JPA.The problem is probably that persistence cartridge doesn't know how to insert it. Normally, in a non ESB environment, you would register a EntityManagerRegister object using the PersistenceUtil#setDAORegister() method. The EntityManagerRegister provides the persistence cartridge with the EntityManagerDaoAdapter. The EntityManagerDaoAdapter is the object that uses the EntityManager to actually persist the PersonAge pojo. Because you are in a ESB enviroment things are a bit different, because you have no way to set the EntityManagerRegister via the PersistenceUtil#setDAORegister() method before Smooks is executed. At the moment there is no standard way to do this from within Smooks so you will have to provide your own.
 
I propose that you write a simple visitor object that is executed on the document start (selector: #document). On the visitBefore method of that visitor you create a EntityManagerRegister, providing it your EntityContext (you could retrieve that via JNDI maybe) and  use the PersistenceUtil#setDAORegister() to register the EntityManagerRegister. Then your problem should be solved.
 
I must say that the persistence cartridge should provide you with a decent exception when no DaoRegister object is available. I will look into that.
 
I hope I provided you with enough an clear enough information to solve your problem.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519957#519957




More information about the jboss-dev-forums mailing list