Hibernate version: 3.2.4.sp1
Name and version of the database you are using:Oracle 10g 10.2.0.4.0. Drivers: ojdbc14.jar
Hello,
I'm having problems reverse engineering an existing oracle database using hibernate tools. The oracle datatype timestamp(6) gets generated as java.io.Serializable, not as timestamp.
The generated class (the columns ADDED_DATE and CHANGED_DATE are of type timestamp(6)):
Code:
package com.testproj.model;
// Generated 2008-aug-05 16:33:56 by Hibernate Tools 3.2.0.CR1
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
/**
* NfOrganisation generated by hbm2java
*/
@Entity
@Table(name = "NF_ORGANISATION")
public class NfOrganisation implements java.io.Serializable {
private String organisationId;
private String beskrivning;
private Serializable addedDate;
private Serializable changedDate;
public NfOrganisation() {
}
public NfOrganisation(String organisationId) {
this.organisationId = organisationId;
}
public NfOrganisation(String organisationId, String beskrivning,
Serializable addedDate, Serializable changedDate) {
this.organisationId = organisationId;
this.beskrivning = beskrivning;
this.addedDate = addedDate;
this.changedDate = changedDate;
}
@Id
@Column(name = "ORGANISATION_ID", unique = true, nullable = false, length = 100)
@NotNull
@Length(max = 100)
public String getOrganisationId() {
return this.organisationId;
}
public void setOrganisationId(String organisationId) {
this.organisationId = organisationId;
}
@Column(name = "BESKRIVNING", length = 100)
@Length(max = 100)
public String getBeskrivning() {
return this.beskrivning;
}
public void setBeskrivning(String beskrivning) {
this.beskrivning = beskrivning;
}
@Column(name = "ADDED_DATE")
public Serializable getAddedDate() {
return this.addedDate;
}
public void setAddedDate(Serializable addedDate) {
this.addedDate = addedDate;
}
@Column(name = "CHANGED_DATE")
public Serializable getChangedDate() {
return this.changedDate;
}
public void setChangedDate(Serializable changedDate) {
this.changedDate = changedDate;
}
}
When trying to deploy the generated app I get this exception:
Code:
16:30:39,284 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:ear=testproj.ear,unitName=testproj
State: FAILED
Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: ADDED_DATE, expected: raw(255)
I Depend On:
jboss.jca:service=DataSourceBinding,name=testprojDatasource
How can I solve this?
\\daniel