-->
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.  [ 5 posts ] 
Author Message
 Post subject: Syntax error: Encountered "," at line 1, column 30
PostPosted: Tue Nov 06, 2007 7:47 pm 
Newbie

Joined: Sun Sep 18, 2005 12:26 am
Posts: 4
Hibernate version:3.2.5ga


I am experiencing what "appears" to be a bug in the SQL generation during a bulk update HQL query.

Given the following two HQL statements:


A) update MailServer m set m.journal=null where m.journal.id=:mailboxId

AND

B) update MailServer m set m.journal=null where m.journal.sync=:enabled

The former works, while the latter fails with the following error:

Code:
Syntax error: Encountered "," at line 1, column 30.


The key differences between the two queries are:

1. Query A is using an integer value, which is also a primary key value,
2. Query B is using a boolean field as the parameter

The raw SQL produced by hibernate in each case is:

A) update Recipient set mailboxId=null where mailboxId=?
B) update Recipient, set mailboxId=null where sync=?

We can see that in the latter query there is a weird comma in the middle of the sql, which causes the error.

This is running on an Apache Derby database (v10.3) using the org.hibernate.dialect.DerbyDialect dialect.

Assuming this is a hibernate problem, does anyone know of a work around? I need/want to do a bulk update because the current solution (one-by-one) is just too slow (to the point it's unworkable for us).

Thanks.[/list]


Top
 Profile  
 
 Post subject: same problem
PostPosted: Wed Mar 05, 2008 4:51 pm 
Beginner
Beginner

Joined: Fri Nov 11, 2005 4:35 pm
Posts: 23
Hi,

Did you found the sollution?
I have the same problem.

Thanks in advance,
Pieter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 7:58 pm 
Newbie

Joined: Sun Sep 18, 2005 12:26 am
Posts: 4
Nope.. as far as I know it's still a bug


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 3:07 am 
Beginner
Beginner

Joined: Fri Nov 11, 2005 4:35 pm
Posts: 23
I found it.

It is because I used a join in the where clause.

For example:
update table set column = 1 where columnB.subcolumnA.z = 1

this will result in the error we had.

It's beter to change the query in:
update table set column = 1 where columnB.id in (select id from table.....)



Thanks for the reply,
Pieter


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 5:28 am 
Newbie

Joined: Sun Sep 18, 2005 12:26 am
Posts: 4
Hmmm.. yeah. I was initially a bit concerned that your "IN" clause may result in an unneccessary row scan, but I think most modern databases "should" be smart enough to realise this is basically a join.

Good work around


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