users@glassfish.java.net

TransactionRequiredException where I do not expect it--pilot error? bug?

From: <glassfish_at_javadesktop.org>
Date: Mon, 26 Jul 2010 19:18:45 PDT

I have put Java EE applications together for around 10 years and haven't seen this issue before. I hope it's some new version of pilot error.

I have a Vaadin (www.vaadin.com) application. A Vaadin application begins with a servlet, and typically you @Inject an Application object into the servlet. The Application object is marked as @SessionScoped. Further details are here: http://vaadin.com/wiki/-/wiki/Main/Creating%20JEE6%20Vaadin%20Applications (see option 2).

Inside that Application class, I've @Injected an Instance<DAO>, where DAO is a local business interface implemented by several of my SLSBs. I've gotten all this working.

For the last several days, I've had my head down coding up UI logic and have finally arrived at the point where my forms and whatnot are ready to invoke business methods on a DAO.

I get my hands on an implementation of the DAO interface, as @Injected through the Instance<DAO> field, and when I call a method here I get a TransactionRequiredException. The SLSB in question has no XML descriptor or extra annotations on it, so of course it should be designated as TRANSACTION_REQUIRED by default.

What simplistic error am I committing? Naively, this smells like CDI somehow losing the fact that the DAO being injected is really an SLSB under the covers--it's like it's "forgetting" to wire up the injected bean as an SLSB, and is instead wiring it up as a POJO.

Thanks,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=478609