Hi Ryan,
Removing transaction-type doesn't make a difference - it's JTA by default in a
Java EE environment. If NetBeans doesn't work correctly, please file a bug with
NetBeans directly.
How do you get a hold of EM? Do you
a) call Persistence.createEMF()
b) inject or look up EMF
c) inject or look up EM
thanks,
-marina
Ryan de Laplante wrote:
> Hi,
>
> I have a Java 5 web application who's only purpose is to provide a web
> service. The web service uses JPA to read an entity from the database,
> make a change and save it back into the db. Because this is not an EJB,
> I have to manually begin and commit a transaction for persist() to work.
>
> When I do the following, the app server throws an IllegalStateException
> ("Cannot use an EntityTransaction while using JTA.")
>
> EntityTransaction trans;
> trans = em.getTransaction();
>
>
> I opened my persistence.xml in NetBean's visual editor, unchecked "Use
> Java Transaction APIs", then saved and redeployed. This did not make a
> difference. I noticed a transaction-type="JTA" attribute was still on
> the <persistence-unit> element so I removed it, saved and redeployed. I
> still get an exception.
>
>
> Thanks,
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>