-->
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.  [ 3 posts ] 
Author Message
 Post subject: Bulk delete generates invalid MySQL syntax?
PostPosted: Fri Mar 24, 2006 9:09 pm 
Newbie

Joined: Sun Jul 31, 2005 7:53 pm
Posts: 17
Dear All,

I am not sure whether this is a Hibernate bug, a EJB3 bug or a MySQL bug, so I thought I'd run it past you before opening a JIRA :)

I have found that the Hibernate EJB-QL query...

Code:
   delete from AssetOwned a where a.member.company.id = :id0


...generates the following SQL (using the MySQL dialect)...

Code:
   delete from AssetOwned, Member member1_ where company_id=?


...which gives...

Code:
   java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where company_id='5c6f394a0a2abaaa010a2ac56e9e0001'' at line 1


Yet it is quite possible to do this if you instead use the SQL...

Code:
   delete from AssetOwned where member_id in (select member_id from Member where company_id = '5c6f394a0a2abaaa010a2ac56e9e0001')


...instead.

Is this a bug? Or am I expecting too much?

Regards,

Richard.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 25, 2006 9:55 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
which Hibernate version?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 26, 2006 12:41 am 
Newbie

Joined: Sun Jul 31, 2005 7:53 pm
Posts: 17
Sorry - 3.1.2, as ships with JBoss 4.0.4RC1


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.