users@glassfish.java.net

Re: Update database using Entity manager in a web service

From: Sanjeeb Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 12 Nov 2010 11:10:43 +0530

Looks like you are running in a managed environment, so you need to use
JTA apis like UserTransaction to control transaction boundaries instead
of using EntityTransaction. Just do a search in the web, you shall find
some better explanation.

Sahoo

On Friday 12 November 2010 10:26 AM, forums_at_java.net wrote:
> I tried to update my db table using Entity manager.
>
> My code was
>
> TableName obj = em.find(TableName.class,TableNameId);
>
> obj.setName("Test");
>
> em.getTransaction().begin(); *<<Exception : Cannot use an
> EntityTransaction while using JTA*
>
> em.getTransaction().commit();
>
> em.close();
>
> How can I update db table using Entity manager????
>
> Z there a way to overcome this problem????
>
>
> --
>
> [Message sent by forum member 'xcyclops40']
>
> View Post: http://forums.java.net/node/716769
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>