Hi,
I am using Hibernate 3.5.5 and Oracle 11gR2 11.2.0.4 and I ran into the following problem:
Code:
[JDBCExceptionReporter] ORA-00932: inconsistent datatypes: expected TIMESTAMP got NUMBER
This is the corresponding query:
Code:
DEBUG [SQL]
select item0_."ID" as col_0_0_,
from
"Item" item0_
where
item0_."DeletionTimestamp" = ?
TRACE [TimestampType] binding '9999-12-31 00:00:00' to parameter: 1
The DeletionTimestamp column is defined as TIMESTAMP in the database table:
Code:
DeletionTimestamp TIMESTAMP(8)
The JPA Entity column as well is defined as TIMESTAMP:
Code:
@Column( name = "`DeletionTimestamp`" )
protected Timestamp deletionTimestamp;
The condition itself will be added to the query using a session filter:
Code:
public static final String PARAM_ALIVE_TIMESTAMP = "aliveTimestamp"; //$NON-NLS-1$
public static final Timestamp ALIVE_TIMESTAMP = Timestamp.valueOf( "9999-12-31 00:00:00" ); //$NON-NLS-1$
...
Filter enableFilter = session.enableFilter( Persistable.FILTER_ALIVE_ONLY )
.setParameter( PARAM_ALIVE_TIMESTAMP, ALIVE_TIMESTAMP );
enableFilter.validate();
The filter definition:
Code:
@FilterDefs( { @FilterDef( name = "aliveOnly", parameters = { @ParamDef( name = "aliveTimestamp", type = "timestamp" ) }, defaultCondition = "`DeletionTimestamp` = :aliveTimestamp" ) } )
@Filters( { @Filter( name = "aliveOnly" ) } )
Any help is greatly appreciated.
Thank you.