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: Call SQL functions by using registerFunction
PostPosted: Thu Jul 12, 2007 4:42 pm 
Newbie

Joined: Mon Jan 09, 2006 11:12 am
Posts: 6
Hibernate version:3.2.4.sp1

I am trying to format DB2 timestamp value where I want to convert space to "-" and ":" to "." To do so I am extending DB2390Dialect and using following method

Code:
registerFunction("timestamp", new StandardSQLFunction("char(?1)"));


I am expecting that hibernate will convert my following SQL statement

Code:
TABLE_A.FIELD_A as H110_1_,
    from
        TABLE_A
    where
        TABLE_A.FIELD_B = XYZ

into

char(TABLE_A.FIELD_A) as H110_1_,
    from
        TABLE_A
    where
        TABLE_A.FIELD_B = XYZ


In my POJO I have declared mapping field to String.

I am getting IllegalArgumentException occurred while calling setter method. Is this the correct way to solve timestamp conversion issue?


Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject: Call SQL functions by using registerFunction
PostPosted: Mon Jul 23, 2007 12:54 pm 
Newbie

Joined: Mon Jan 09, 2006 11:12 am
Posts: 6
This issue was resolved by simply changing datatype java.util.Date to java.sql.Timestamp

There is no need to call registerFunction.


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.