-->
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.  [ 1 post ] 
Author Message
 Post subject: Updating boolean values with MaxDB
PostPosted: Tue Jul 10, 2007 2:20 pm 
Newbie

Joined: Tue Jul 10, 2007 1:19 pm
Posts: 3
Hello!

The following code fragment works for MySQL, but does not for SAP-DB:
Code:
getExtHibernateTemplate().bulkUpdate("UPDATE AbstractOrder SET recent = false WHERE mainOrderId = :mainOrderId OR id = :mainOrderId", new String[]{"recent"}, new Object[]{false, order.getMainOrderId()});


The query Hibernate generates is:
Code:
update abstract_order set recent=0 where (id) IN (select id from temp.HT_abstract_order)


The MaxDB error is "Constant must be compatible with column type and length". The following query works (I tried it on the sqlcli console):
Code:
update abstract_order set recent=false where (id) IN (select id from temp.HT_abstract_order)


A workaround that works both with MySQL and MaxDB:
Code:
getExtHibernateTemplate().bulkUpdate("UPDATE AbstractOrder SET recent = :recent WHERE mainOrderId = :mainOrderId OR id = :mainOrderId", new String[]{"recent", "mainOrderId"}, new Object[]{false, order.getMainOrderId()});


This generates the following code:
Code:
update abstract_order set recent=? where (id) IN (select id from temp.HT_abstract_order)


Is there something I can do about this issue? (Passing a constant as a variable parameter doesn't seam too clever.) Can I change the way Hibernate converts the UPDATE HQL query to a SQL query? Is this a bug I should file in the JIRA?

Thanks for any help,
Matthias


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

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.