These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Bulk delete (executeUpdate) bug?
PostPosted: Fri Jul 15, 2005 12:20 pm 
Beginner
Beginner

Joined: Tue Jun 14, 2005 12:14 pm
Posts: 37
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 1:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You should test against current HB3 CVS; this code has changed a lot.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.