From: Keenan R. (JIRA) <no...@at...> - 2006-06-15 19:40:34
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1566?page=comments#action_23346 ] Keenan Ross commented on HHH-1566: ---------------------------------- 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/java/sqlj_jdbc/htdocs/jdbc_faq_0.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 > SchemaValidator Complains about Oracle Date Columns > --------------------------------------------------- > > Key: HHH-1566 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1566 > Project: Hibernate3 > Type: Bug > Versions: 3.1.1 > Environment: Hibernate 3.1.1, Annotations 3.1B8, EntityManager 3.1B6, Oracle 10g > Reporter: Keenan Ross > > > In the EJB3 Persistence forum, http://forum.hibernate.org/viewtopic.php?t=956307#2295709, Emmanuel suggested submit a bug report for this issue: > The SchemaValidator objects to a Oracle column declared with the DATE datatype and annotated as TemporalType.TIMESTAMP. > The SchemaValidator complains: > javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: LAST_UPDATE, expected: timestamp > on a persistent property declared as > @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 > 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 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |