Hi,
I am using Hibernate3 and MySQL 4.1.9 Professional. I wanted to delete an entity with the Query API:
Query q = sessionFactory.createQuery("delete Entity where id=?");
...
return q.executeUpdate();
However, when executing this, I get a syntax error from MySQL. I pasted the generated SQL and used in another database client and still got the same error. It seems that MySQL 4.1.9 does not allow table aliases in the DELETE clause.
The generated SQL looks like this: delete from Entity entity0_ where id=?
It seems MySQL does not support the alias for the table name. I configured the session factory to use org.hibernate.dialect.MySQLDialect.
How can I disable the generation of the dialect?
Thanks,
Cristian
|