Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.5
Issue:
My mapping document is lengthy, so trying to summarize:
Code:
class A extends class B (using table per class hierarchy)
class B has a couple of components (simple strings)
Execute the following statement:
Code:
session.createQuery("delete B where id in (3, 4)").executeUpdate();
throws the following exception within Hibernate:
Full stack trace of any exception that occurs:Code:
[junit] String index out of range: -1
[junit] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
[junit] at java.lang.String.substring(String.java:1444)
[junit] at org.hibernate.hql.ast.SyntheticAndFactory.parseEqFragmentToSubtree(SyntheticAndFactory.java:124)
[junit] at org.hibernate.hql.ast.SyntheticAndFactory.addDiscriminatorWhereFragment(SyntheticAndFactory.java:108)
[junit] at org.hibernate.hql.ast.HqlSqlWalker.postProcessDelete(HqlSqlWalker.java:426)
[junit] at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:175)
[junit] at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
[junit] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
[junit] at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
[junit] at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
[junit] at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
[junit] at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
[junit] at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
Name and version of the database: MySQL 4.1 (InnoDB)
I have been successful with the same query, but on simple mappings, such as a single entity with no components and/or inheritance hierarchies. It looks like a Hibernate bug (but I haven't yet ruled out my own stupidity :))
Any thoughts?
Thanks,
Liem