users@glassfish.java.net

Re: exception inserted a deleted entity

From: <glassfish_at_javadesktop.org>
Date: Tue, 22 May 2007 14:44:21 PDT

> > em.cache()?
>
> First of all I cannot see this function?
>

Me too but this is what you wrote ;).

> The transaction level is set to the container default, which from studying it means it creates a new transaction around the inserts but doesn't use a transaction for the selects.

It's TopLink that tries to help the users, but it doesn't work in many cases - they use a non-tx connection for a query execution until they know for sure that a particular call must be part of the transaction.


> I believe the delete query is in JPQL as it is created by using
>
> [i]@NamedQuery (name="deleteQ", query="DELETE FROM yyy WHERE xxx");
> [...] I thought i had to use @NamedNativeQuery or em.createNativeQuery to execute a native query?

Your query looks like a JPQL query, and I don't see a need to use a native query here.

Yes, there is no em.createNamedNativeQuery() API - you need to use either em.createNativeQuery() or em.createNamedQuery() with @NamedNativeQuery.

Regards,
-marina
[Message sent by forum member 'mvatkina' (mvatkina)]

http://forums.java.net/jive/thread.jspa?messageID=218421