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]