Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: JSF/JPA problem Date: Tue, 13 Sep 2011 17:06:41 -0700 Organization: A noiseless patient Spider Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 14 Sep 2011 00:06:44 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="13227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6jJoeWmzJP7qV1rqB5DaNV0kqg2Xpa48=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: Cancel-Lock: sha1:sEPBAT5qk0a+6wkkvUCXUus3iNs= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7995 On 9/13/2011 4:45 PM, Arved Sandstrom wrote: > You could try leaving out the flush(), and simply close the EM at the > end of createPost(). This would track Example 5.7.1.1. Let's see if you > still get the TransactionRequiredException. That would then demonstrate > that there really is no active JTA transaction... > Since you expect to be set up for JTA, you could also dispense with the > use of application-managed, and use @PersistenceContext DI instead, a la > Example 5.6.4.1 - this is about as easy as it gets. Just to reiterate the post I just added to this thread, I already switched to PersistenceContext for DI, and the error has now moved from the em.flush() to the em.persist( post ) on the line previous. So I have to conclude that if I add an em.close(), I'll still now have the error previous to the close(). I'll give it a try at some point. > You have me interested; I will try this situation out on Glassfish. Thanks for playing around with this, it really has me stumped.