-->
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: @SQLInsert and ON DUPLICATE KEY...
PostPosted: Mon Dec 21, 2009 2:20 pm 
Newbie

Joined: Mon Dec 21, 2009 1:06 pm
Posts: 1
Hi,
I'm trying to use the @SQLInsert annotation with a table that has 6 properties (columns), the 1st one being auto-generated (GenerationType.AUTO).
The table has two unique indexes (PK (ID) and OWNERID)
Code:
@SQLInsert(sql = "INSERT INTO CARS(OWNERID, WHEELS, SPEED, GAZOLINE, LASTUPDATE) VALUES (?,?,?,?,?)"+
" ON DUPLICATE KEY UPDATE WHEELS=?, SPEED=?, GAZOLINE=?, LASTUPDATE=now()")
An error is generated for inserts: no value for the 6th parameter. [note: the 1st param is ID, the PK]
My questions are

- Is the above query runable (parseable) by Hibernate, being smart enough to understand the On Duplicate key syntax, and reuse the parameters where necessary according to the field names?
[probably no, according to my tests, meaning Hibernate cannot understand the syntax of all SQLs, above is for MySQL]


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.