users@glassfish.java.net

Re: Glassfish Oracle Mystery

From: Sahoo <Sahoo_at_Sun.COM>
Date: Mon, 29 Oct 2007 14:09:54 +0530

1. Run your original code, i.e., *without* getTransaction().begin() and
commit. Since you are using an injected entity manager, you mst not use
getTransaction().begin() or commit().

2. See what SQL is being issued by TopLink Essential. You can configure
your persistence.xml [1], redeploy and rerun to see the SQL.

Sahoo

[1]
https://glassfish.dev.java.net/javaee5/persistence/persistence_faq.html#45

Kenneth Clark wrote:
> There is nothing in the log file other than “Cannot use an EntityTransaction while using JTA.” When I try using the em.getTransaction.
>
> I am not understanding what you mean by "what sql is being run" as I am using the entity manager to persist the data and update the data.
>
> The scenario is as follows. Frontend populates objected to be merged, is passed back to the webservice, the webservice calls em.merge(object) and then the frontend requests a list of those specific objects. The returned list reflects the changes but the database does not. Hence my conclusion that the transaction is not being committed.
>
> I noted this behavior on Postgres and resolved it by using em.getTransaction().begin() and commit()
>
> ________________
> Thanks and regards
>
> Kenneth Clark
> Solutions Engineer
>
>
> Tel: 27 11 679 3075
> Mobile: 27 (0) 84 583 1348
> Email: kenneth.clark_at_skyetech.co.za
> Website: http://www.skyetech.co.za
>
>
> -----Original Message-----
> From: Sanjeeb.Sahoo_at_Sun.COM [mailto:Sanjeeb.Sahoo_at_Sun.COM] On Behalf Of Sahoo
> Sent: 29 October 2007 08:51
> To: users_at_glassfish.dev.java.net
> Subject: Re: Glassfish Oracle Mystery
>
> With your *original* code, what SQL statements are executed when you run
> your program? That might give a clue.
> Also, are there any exceptions in the log file?
>
> Thanks,
> Sahoo
>
> Kenneth Clark wrote:
>
>> Nope, still nothing.
>>
>> I removed the em.getTransaction and added the em.flush() below the em.merge() and it is not committing the transactions. It is mind boggling because the em.persist is working but the em.merge does not!?!
>>
>> Any further ideas?
>>
>> ________________
>> Thanks and regards
>>
>> Kenneth Clark
>> Solutions Engineer
>>
>>
>> Tel: 27 11 679 3075
>> Mobile: 27 (0) 84 583 1348
>> Email: kenneth.clark_at_skyetech.co.za
>> Website: http://www.skyetech.co.za
>>
>>
>> -----Original Message-----
>> From: glassfish_at_javadesktop.org [mailto:glassfish_at_javadesktop.org]
>> Sent: 28 October 2007 04:41
>> To: users_at_glassfish.dev.java.net
>> Subject: Re: Glassfish Oracle Mystery
>>
>> em.getTransaction() is intended for Java SE environment. You shouldn't use em.getTransaction() in your session beans. Your session bean by default uses container managed transaction so each business method already executes in the context of a JTA transaction. If this method is invoked via its webservice endpoint, the container will wrap the method body with a transaction. Not sure why the tx is not committed. You may want to try add a em.flush() after merge, though it is not really needed.
>>
>> -cheng
>> [Message sent by forum member 'cf126330' (cf126330)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=242512
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.503 / Virus Database: 269.15.12/1097 - Release Date: 2007/10/28 13:58
>>
>>
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.5.503 / Virus Database: 269.15.12/1097 - Release Date: 2007/10/28 13:58
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.12/1097 - Release Date: 2007/10/28 13:58
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.12/1097 - Release Date: 2007/10/28 13:58
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>