cancel
Showing results for 
Search instead for 
Did you mean: 

JPA: EntityManager#remove: OpenSQL statement contains syntax error

Former Member
0 Kudos

Hi,

trying to remove an entity as follows:


        Query geMyEntity = entityManager.createNamedQuery("getMyEntityByReference");
        getMyEntity.setParameter("reference", "...");

        MyEntity me = (MyEntity) getMyEntity.getSingleResult();
        entityManager.remove(me);

yields the following error:


Caused by: com.sap.sql.log.OpenSQLException: The SQL statement "DELETE FROM "SAPSP5DB"."MY_TABLE" WHERE "SAPSP5DB"."MY_TABLE"."ID" = ?" contains the syntax error[s]: - Open SQL syntax error: column names must not specify a schema name (delete "SAPSP5DB". before "MY_TABLE"."ID").

What am I missing? Thank you for your help in advance.

Cheers,

Felix

Edited by: Felix Geller on May 14, 2008 9:44 AM

Edited by: Felix Geller on May 14, 2008 10:31 AM

Accepted Solutions (1)

Accepted Solutions (1)

adrian_goerler
Active Participant
0 Kudos

Hi Felix,

we'd have to look into this deeper to find out why this happens. I'd guess that your @Table annotation includes a "schema" element that might confuse here. If so, I suggest that you remove it. Its not needed when running on the system data source.

I hope this helps,

Adrian

Former Member
0 Kudos

Hi Adrian,

yes, I figured as much, was just confused that my passing of the parameter causes the problem. In any case, thank you for your help! Is there a place where I should report this behavior?

Cheers,

Felix

adrian_goerler
Active Participant
0 Kudos

Hi Felix,

I have reported it to the colleague who does the SQL generation.

Regards,

Adrian

Answers (0)