Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7988
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe09.iad.POSTED!8ad76e89!not-for-mail |
|---|---|
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JSF/JPA problem |
| References | <j4nvr9$4ld$1@dont-email.me> <VZObq.20744$oz6.19581@newsfe11.iad> |
| In-Reply-To | <VZObq.20744$oz6.19581@newsfe11.iad> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| Lines | 39 |
| Message-ID | <XcPbq.17471$CQ4.165@newsfe09.iad> (permalink) |
| X-Complaints-To | abuse@newsgroups-download.com |
| NNTP-Posting-Date | Tue, 13 Sep 2011 20:40:23 UTC |
| Organization | Public Usenet Newsgroup Access |
| Date | Tue, 13 Sep 2011 17:40:22 -0300 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7988 |
Show key headers only | View raw
On 11-09-13 05:24 PM, Arved Sandstrom wrote: > On 11-09-13 01:19 PM, markspace wrote: >> Hi all, I'm playing around with JSF and JPA on a personal project and >> I've got a problem I haven't been able to figure out. Basically no >> matter what I do in a certain bit of code, I always get a JPA error that >> there is no transaction available for the current thread. > [ SNIP ] > > You're using application-managed entity managers because of your use of > an EntityManagerFactory. You must therefore use EntityTransaction. > > If you want container-managed then inject with @PersistenceContext, and > specify JTA in your persistence.xml (Note: with application-managed > you'd typically have RESOURCE_LOCAL). > > AHS > I should elaborate: if you're in a JTA environment there is also the option of using UserTransaction with your application-managed EMs (see http://download.oracle.com/docs/cd/E19798-01/821-1841/bnbra/index.html) This is not something that I have found myself doing personally: I either use application-managed EMs with the EntityTransaction API (hence RESOURCE_LOCAL), or container-managed EMs with container-managed JTA transactions. On a side note: if you're Java EE 6 (and judging by the "postBean.createNewPost()" maybe you are) then you might want to use CDI and the @Named and @Inject annotations rather than @ManagedBean and @ManagedProperty. With a Java EE 6 server (like Glassfish 3) you'll have the Weld reference implementation of CDI included most likely, and all you have to do is set up a beans.xml file in your WEB-INF to kickstart it. HTH, AHS -- job creator: US Republican term for a wealthy party contributor
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
JSF/JPA problem markspace <-@.> - 2011-09-13 09:19 -0700
Re: JSF/JPA problem Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-13 17:24 -0300
Re: JSF/JPA problem Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-13 17:40 -0300
Re: JSF/JPA problem markspace <-@.> - 2011-09-13 15:38 -0700
Re: JSF/JPA problem markspace <-@.> - 2011-09-13 17:06 -0700
Re: JSF/JPA problem Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-13 22:28 -0300
Re: JSF/JPA problem Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-13 22:31 -0300
Re: JSF/JPA problem markspace <-@.> - 2011-09-13 19:27 -0700
Re: JSF/JPA problem Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-14 05:59 -0300
Re: JSF/JPA problem markspace <-@.> - 2011-09-14 10:36 -0700
Re: JSF/JPA problem Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-14 17:51 -0300
Re: JSF/JPA problem markspace <-@.> - 2011-09-13 16:12 -0700
csiph-web