Hi,
I'm using custom SQL annotations to do soft-deletes of my entities:
Quote:
@SQLDelete(sql = "UPDATE note SET deleted = (1) WHERE id = ? AND version = ?")
Because we use optimistic locking, the parameter sequence for the delete statement is 'id', 'version':
Quote:
INFO [STDOUT] Hibernate: delete from ListItem where id=? and version=?
Now, when delete is called through a cascade, the parameter sequence is different. It soly consists of 'id':
Quote:
INFO [STDOUT] Hibernate: delete from Note where id=?
In this case, I get an exeption based on my custom SQL expecting two parameters:
Quote:
ERROR [JDBCExceptionReporter] No value specified for parameter 2
The docs state that "The order of the positional parameters is vital, as they must be in the same sequence as Hibernate expects them"
If, for the same operation, Hibernate uses different parameter sequences, Is there a way to dynamicaly ajust the custom SQL?
Thank you!
- Chris