- This topic has 7 replies, 6 voices, and was last updated 16 years, 1 month ago by
Brian Fernandes.
-
AuthorPosts
-
Scott DunbarParticipantI’m reverse engineering a Postgres 8.3 database. My column type is timestamp. When the code is generated from the reverse engineering it looks like:
@Temporal(TemporalType.TIMESTAMP) @Column(name = "last_update", nullable = false, length = 29) public Timestamp getLastUpdate() { return this.lastUpdate; }
However, if I leave this code as is I get an exception from Hibernate:
Caused by: org.hibernate.AnnotationException: @Temporal should be set on a java.util.Date or java.util.Calendar property: package.Company.createDate at org.hibernate.cfg.annotations.SimpleValueBinder.setType(SimpleValueBinder.java:93) at org.hibernate.cfg.annotations.PropertyBinder.bind(PropertyBinder.java:117) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1581) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:733)
If I remove the @Temporal annotation the code works fine. Is this a Hibernate problem or a JPA problem?
Thanks for any help.
February 18, 2009 at 8:48 am #294972
Loyal WaterMemberstdunbar,
The dev team is looking into this issue and they will get back to you with a reply asap.March 21, 2009 at 6:19 pm #296492
bimkiMemberhi,
did You solve this problem?March 22, 2009 at 9:25 am #296498
GritsMcgeeMemberI’m having the same issue reverse engineering a MySQL database. Column type is DATETIME, the reverse engineering is generating a java.sql.timestamp type but than also adding a TemporalType.TIMESTAMP annotation which is not needed.
private Timestamp crtDttm; private Timestamp mdfyDttm;
@Temporal(TemporalType.TIMESTAMP) @Column(name = "CRT_DTTM", nullable = false, length = 19) public Timestamp getCrtDttm() { return this.crtDttm; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "MDFY_DTTM", length = 19) public Timestamp getMdfyDttm() { return this.mdfyDttm; }
April 9, 2009 at 5:12 pm #297411
Unmesh KulkarniMemberHi,
I ran into a severe problem while doing JPA reverse engineering from MySQL 5 to Java classes using MyEclispe Version: 7.1.
Environment: MyEclipse Build id: 7.1-20090306, Java jdk1.5.0_14 and Tomcat 5.0.28.
At runtime, the application is throwing the following exception:
javax.persistence.PersistenceException: org.hibernate.AnnotationException: @Temporal should be set on a java.util.Date or java.util.Calendar property: com.sourcestio.reviewsframework.model.ReviewTemplate.creationDateThe column in my table is as under:
creation_date timestamp(8) not null,The generated code as the annonation as under:
@Temporal(TemporalType.TIMESTAMP)
@Column(name=”creation_date”, nullable=false, length=19)So basically the code is adding an @Temporal annotation for TIMESTAMP, which is not allowed.
By the way, this problem started after I updated from MyEclipse 6 to 7. With MyEclipse 6, the TemporalType was getting generated as DATE, which has it’s own set of problems:
@Temporal(TemporalType.DATE)
@Column(name=”creation_date”, unique=false, nullable=false, insertable=true, updatable=true, length=19)What’s happening with 7.1 is a big problem, because we have the creation_date and modification_date columns in every table.
Are there any workarounds to suppress the TemporalType generation?
If not, when can I expect this bug to be fixed?
Thanks,
UnmeshApril 16, 2009 at 4:37 pm #297651
Unmesh KulkarniMemberMyEclipse Support,
This bug seems to be open for a long time, yet for months there is no response apart from “The dev team is looking into this issue and they will get back to you with a reply asap.”.
Can I expect a commitment fixing this sometime soon?
Thank you,
UnmeshApril 23, 2009 at 6:09 pm #297835
Brian FernandesModeratorI have replicated this problem locally and we will be fixing this in the next release of MyEclipse, priority has been suitably raised. Unfortunately I cannot suggest a workaround for this problem at this point, I’m sorry you ran into this issue.
May 28, 2009 at 7:55 am #298829
Brian FernandesModeratorThis problem has been fixed in 7.5M1, can you please try a sample reverse engineering pass in this version and let us know if you run into any issues? This will ensure we catch problems before the GA version is released in a few weeks.
Thanks!
-
AuthorPosts