There seems to be a problem with this dialect and using native id generator.
I have a table that has a PK column defined as:
I_SECURITY_LOG_ID Integer NOT NULL AUTOINCREMENT
in my Pojo I define the hibernate mapping using XDoclet as
private int id;
/**
*@hibernate.id column="I_SECURITY_LOG_ID" generator-class = "native"
*/
public int getId()
{
return id;
}
When I create a new Pojo, set all of it's attributes, and then call saveOrUpdate(pojo), I get a prepared statement exception saying "Column '@p0' not found".
If I change the Pojo to use my own key generator class and not have the database autoincrement, then it works fine.
I can trace all the way to the execution of the prepared statement, and if I run the same statement externally using ISQL and inserting the variables manually, both the insert and the select @@identity seem to work fine.
My only conclusion is that there is something going on inside the Dialect that I can't see that isn't working correctly. I could be wrong... :-) BTW, the database version is Sybase AnyWhere version 7.x I am currently unable to confirm it with Sybase Anywhere 9.x as I don't have version 9.x available to test.
|