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.  [ 1 post ] 
Author Message
 Post subject: TemporalType.TIMESTAMP
PostPosted: Fri Jul 10, 2009 3:46 pm 
Newbie

Joined: Wed Oct 22, 2008 11:44 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.