-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate 3.5.5 and Ora11gR2 expected TIMESTAMP got NUMBER
PostPosted: Thu Jul 30, 2015 10:18 pm 
Newbie

Joined: Thu Jul 30, 2015 9:43 pm
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: Hibernate 3.5.5 and Ora11gR2 expected TIMESTAMP got NUMBER
PostPosted: Fri Jul 31, 2015 6:19 pm 
Newbie

Joined: Thu Jul 30, 2015 9:43 pm
Posts: 2
I solved it - I need to apply the defaultContion as condition to the Filter as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.