Hi Fabien,Sounds like a bug in the OpenJPA HSQLDB driver. Can you file a bug in JIRA (and if you have the time, provide a patch for the driver). Take a look at allowsAliasInBulkClause that configures the behavior of the DELETE FROM SQL translation.
Thanks, Craig On Sep 14, 2009, at 12:19 AM, Fabien Charlet wrote:
Hello ! I'm quite new to JPA and OpenJPA. I have developped a DAL using OpenJPA and HSQLDB for tests. My problem is when I launch a "Delete from" query, HSQLDB complains about a malformed SQL syntax. Here is my query : final Query q = entityManager.get().createQuery("DELETE FROM Log"); q.executeUpdate(); Where Log is an entity configured. But OpenJPA generates the query : DELETE FROM LOG t0 And HsqlDB replies : Caused by: org.hsqldb.HsqlException: unexpected token: T0 at org.hsqldb.Error.error(Error.java:76) at org.hsqldb.ParserBase.unexpectedToken(ParserBase.java:749) at org.hsqldb.ParserCommand.compileStatement(ParserCommand.java:66) at org.hsqldb.Session.compileStatement(Session.java:808) at org.hsqldb.StatementManager.compile(StatementManager.java:418) at org.hsqldb.Session.execute(Session.java:882)at org .hsqldb.jdbc.JDBCPreparedStatement.<init>(JDBCPreparedStatement.java: 3631)I quickly looked at HsqlDB specs (http://hsqldb.org/web/hsqlDocsFrame.html), where I find that the query should be DELETE FROM LOG without the ending T0. Is someone know this issue ? I am using OpenJPA 1.2.1 and HsqlDB hsqldb-1.9.0-rc4 Thanks for help. -- Cordialement Fabien CHARLET
Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
