-->
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.  [ 6 posts ] 
Author Message
 Post subject: Oracle Date support with Hibernate
PostPosted: Fri Dec 28, 2007 4:51 am 
Newbie

Joined: Fri Dec 28, 2007 4:40 am
Posts: 3
Location: HYDERABAD
Hi ,
I am having code which runs well with Mysql and SQL Server ,i am Hibernate to map with DataBase .
And i am using same piece of code with Oracle With Hibernate to Map to DataBase . But i am facing problems with Oracle Date .

The Date field in the Hibernate Mappping file works fine with the MySql and SQL Server.
But for Oracle its causing a problem.
When i use to_date for the Oracle it just works fine.

Can anyone suggest a work around at Hibernate layer or at the Oracle Database , so that i can run same piece of code ,which is running on other two.

Thanks
Srivastava

[/quote][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 28, 2007 7:26 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
Quote:
... i am using same piece of code with Oracle With Hibernate to Map to DataBase . But i am facing problems with Oracle Date .
The Date field in the Hibernate Mappping file works fine with the MySql and SQL Server.
But for Oracle its causing a problem.


and how should we know what is the problem you've been facing with? Is there any exception? what is odd about Oracle's Date?

Is there any difference between the date you store in database and the date you retrieve? (a 1 day difference?)

If that's the case, the reason is Oracle does not have a only DATE type, it's DATE type is DATETIME type compared to other databases. And I believe there is a bug in Oracle's JDBC driver.

The solve the problem just disable "daylight saving" of the operating system which runs the Java application.

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 28, 2007 7:29 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
Quote:
... i am using same piece of code with Oracle With Hibernate to Map to DataBase . But i am facing problems with Oracle Date .
The Date field in the Hibernate Mappping file works fine with the MySql and SQL Server.
But for Oracle its causing a problem.


and how should we know what is the problem you've been facing with? Is there any exception? what is odd about Oracle's Date?

Is there any difference between the date you store in database and the date you retrieve? (a 1 day difference?)

If that's the case, the reason is Oracle does not have a only DATE type, it's DATE type is DATETIME type compared to other databases. And I believe there is a bug in Oracle's JDBC driver.

The solve the problem just disable "daylight saving" of the operating system which runs the Java application.

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject: Problem with the oracle Date
PostPosted: Fri Dec 28, 2007 10:17 am 
Newbie

Joined: Fri Dec 28, 2007 4:40 am
Posts: 3
Location: HYDERABAD
HI ,
thanks for your response .

I have problem retreving date from the database .

In the database the one of the columns is having the date field ,
now i am trying to retrieve the data , it throws throws the exception saying that ora 01861 :exception one of the literal is not correctly matched.


All the Date manipulations are casuing the same problem..


Thanks
Srivastava


Last edited by vastav5star on Fri Dec 28, 2007 10:23 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Problem with oracle date
PostPosted: Fri Dec 28, 2007 10:22 am 
Newbie

Joined: Fri Dec 28, 2007 4:40 am
Posts: 3
Location: HYDERABAD
This is the error i am getting

ORA-01861: literal does not match format string


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 28, 2007 10:33 am 
Regular
Regular

Joined: Sat Nov 25, 2006 11:37 am
Posts: 72
How do you retrieve, e.g. using a Hibernate criteria or a HQL query or a native query? And how do you specify the argument causing the problem? It could be as simple as the date format expected by Oracle is different to what you or Hibernate or the JDBC driver (see 1st question) put into the query.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.