Hi, I am running into trouble using @SQLInsert annotation and inserting a current_timestamp. I have tried the following:
Code:
@SQLInsert(sql = "INSERT INTO MY_TABLE(id, value1, date1) values (?, ?, current_timestamp)
@SQLInsert(sql = "INSERT INTO MY_TABLE(id, value1, date1) values (?, ?, (select current_timestamp from dual))
I am getting an ORA-01722: invalid number error. When I copy/paste the corresponding generated SQL from the log to SQLDeveloper, the statement executes without error (obviously after filling the parameters).
I assume I am missing something small here, any ideas? I am using Hibernate 3.2.6 with Hibernate Annotation 3.3.1 and Oracle with Oracle10gDialect If any more info is required I will provide it.
Here is a simplified version of the code....
Code:
@Entity(name = "MyClass")
@Table(name = "MY_TABLE")
@SQLInsert(sql = "INSERT INTO MY_TABLE(id, value1, date1) values (?, ?, current_timestamp)
public class MyClass {
@Column(name = "DATE1", insertable = false)
private Date date;
@Column(name = "VALUE1")
private String value;
}
TIA,
- Steve