AprilandJake.com

Inner Joins in JPQL Delete Statements

I'm working on a project that utilizes JPA/Hibernate as its ORM. I was writing a few named queries for an JPQL/HQL delete and was getting an SQLGrammarException. I soon found out that I couldn't use inner joins on a delete statement, even at the SQL level. Here's the query transformation:

Hibernate's @Enumerated Annotation is Brittle

Hibernate's @Enumerated annotation seems much too brittle in the case of using it with EnumType.ORDINAL. If you're using EnumType.STRING, I think it works beautifully. This is because the annotation can use the name of the enum to make the mapping. In the case of ORDINAL, the value of the enum is used. This presents a couple problems...