When I use MyEclipse to generate my data objects. The problem I am having is that it does not appear to translate the MySQL5.1 datetime to the correct TemporalType of TIMESTAMP.
If I have a field name of start_date I get the following:
@Temporal(TemporalType.DATE) @Column(name = "START_DATE", length = 0) public Date getStartDate() { return this.startDate; }
I then have to manually change this to TemporalType.TIMESTAMP. If I don't do this I get an error during validation of the following:
[java] Caused by: org.hibernate.HibernateException: Wrong column type in sagepoint.task for column START_DATE. Found: datetime, expected: date [java] at org.hibernate.mapping.Table.validateColumns(Table.java:284) [java] at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1116) [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139) [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:349) [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) [java] at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) [java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
I would prefer to not to have to make the manual conversion to TIMESTAMP.
Your help is appreciated.
Thanks, Bill
|