-->
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.  [ 4 posts ] 
Author Message
 Post subject: SchemaValidator Complains about Oracle Date Columns
PostPosted: Fri Mar 03, 2006 3:06 pm 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Hibernate 3.1.1, Annotations 3.1B8, EntityManager 3.1B6, Oracle 10g

The SchemaValidator objects to a Oracle column declared with the DATA datatype and annotated as TemporalType.TIMESTAMP.

The SchemaValidator complains:
Code:
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: LAST_UPDATE, expected: timestamp

on a persistent property declared as
Code:
@Column(name="LAST_UPDATE", unique=false, nullable=false, insertable=true, updatable=true, length=7)
@Temporal(TemporalType.TIMESTAMP)
public Date getLastUpdate() {
    return this.lastUpdate;
}

with DDL
Code:
CREATE TABLE plate (..., last_update DATE NOT NULL, ...)


In Oracle, the DATE datatype contains both date and time information, much like java.lang.Date, so a TIMESTAMP temporal type should be a valid mapping. Indeed it is the only valid mapping, because while attempts to use TemporalType.DATE or TemporalType.TIME in the above example pass the SchemaValidator, they yeild Java Dates that contain only the date or time portions, respectively.

From a brief review of the Hibernate code, it seems that each Dialect maps to an appropriate type, potentially out of several, while the validator thinks that is the only valid mapping.
--keenan


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 12, 2006 4:38 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Please open a bug in JIRA (Hibernate3 project)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 4:48 pm 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Done, available at: http://opensource2.atlassian.com/projects/hibernate/browse/HHH-1566
--keenan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 3:43 pm 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Some comments I just added to the JIRA issue:

Quote:
The reported behavior differs based on which version of the Oracle JDBC driver you use. The most recent drivers (10.2) exercize this bug. It was introduced in the 9.2 drivers when Oracle changed the Column Metadata returned for a column of type DATE from javax.sql.Timestamp to javax.sql.Date, in the 9.2 drivers. You can read more about the change at: http://www.oracle.com/technology/tech/j ... .htm#08_01

The suggested workaround, oracle.jdbc.V8Compatible=true, does indeed make the bug go away, but given the prevelance of the 10g drivers, we should fix it in the base configuration.

The bug is still present in the now current Hibernate releases:
* Hibernate Core 3.2.0.CR2 (CR is Candidate for Release)
* Hibernate Annotation 3.2.0.CR1
* Hibernate Entity Manager 3.2.0.CR1


--keenan


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