-->
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 support to Date functions
PostPosted: Wed Apr 13, 2005 8:07 am 
Newbie

Joined: Fri May 21, 2004 2:59 am
Posts: 12
Hi All,

In my application I am using 2 different data bases .

1.SQL Server and 2.Oracle.

So in hibernate.properties file i have written the mapping for both the databases.

So if i want to use SQL Server i am uncommenting the related and mapping and commenting the Oracle mapping.

I have written all the queries using Hibernate Query Language.

The problem is when i am performing "date based search"...

I made to convert the date column in the database using todate() in oracle and other date function in SQL Server. for this reason every time if i change the type of the database i used , i need to change the particular query.

Ex:

select new AbcVO(avo.sno) from AbcVO avo where date(avo.joindate)="mydate"

in the above query i am using the date() function to convert the data base date time value into date. So this date function is changing with respect to the datbase.


So how the hibernate supports both the queries without using any different date functions.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 9:06 am 
Beginner
Beginner

Joined: Tue Mar 15, 2005 1:26 am
Posts: 20
do not use any function in sql if you want your code to run on more than one database. use ANSI SQL is enough for most case.

_________________
OR maping? not familar. seems easy select, hard delete/update


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.