Hibernate version: 3.2.0ga
Hi everyone!
I'm sorry, I have a custom UserType that maps to a varchar, with a nullSafeSet like this:
Code:
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
Object val = null;
if(st.getMetaData()==null){
// so this is a Insert or Update, I must generate the value automatically
val=... // complex business rule
}
else{
// this is a Select, just pass the value on
val=value;
}
Hibernate.STRING.set(st, val, index);
}
The objective is to generate the value automatically on insert, based on some complex business rule.. Everything works fine with MySQL and PostgreSQL, but with Oracle I get a "statement handle not executed" exception on getMetaData() (using ojdbc14.jar, version 10.2.0.3.0)..
Is there another way to find out if nullSafeSet is called on "insert" or on "select"?
Many thanks for your time!