]
Mathias Arens commented on HHH-1566:
------------------------------------
A workaround would be to set in the column annotation the columnDefition attribute to
'DATE'. The the validator does not complain anymore.
{code:Java}
@Column(name = "VALID_UNTIL", columnDefinition="DATE")
private Date validUntil;
{code}
This worked in my case (Hibernate 3.5.5-Final) very well.
SchemaValidator Complains about Oracle Date Columns
---------------------------------------------------
Key: HHH-1566
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1566
Project: Hibernate Core
Issue Type: Bug
Affects 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: