Hello,
I had a table with the name 'group' and I used this table in a HQL query.
I got the following error :
Code:
javax.ejb.EJBException: java.lang.ClassCastException: org.hibernate.hql.ast.tree.SqlNode
( It could be great to get a more specific exception in this case )
I have found out that we can define the @Table annotation with the backquote (`) in order to quote the tablename in the query.
Code:
@Entity
@Table(name = "`group`"....
it had quoted the tablename in the query but this hadn't fixed my problem.
My actual problem was that the alias to this table was 'group'.
Since I was doing join on this table, I have defined an alias with the name of the table.
Code:
left join questionnairegroups.group as group
I fixed the issue with a simple rename from 'group' to 'groupe'.
It works fine, I'm simply wondering if there is a way to use such database keyword for alias ?
I know that it's not recommended to use database keyword as table name, but the database need to match with the vocabulary of the domain so...
Thanks in advance for any feedback
Regards,
Christophe