DBRE Bug: TIMESTAMP column annotated as DATE for Join Table
I've discovered this problem during DBRE for Roo 1.2.2.RELEASE with MySQL (5.5 on OS X 10.6). Here is a description of the join table:
Code:
mysql> describe CardActionCard;
+----------------+------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------------------+-------+
| cardActionId | bigint(20) | NO | | NULL | |
| cardId | bigint(20) | NO | | NULL | |
| cardActionDate | timestamp | NO | | 0000-00-00 00:00:00 | |
+----------------+------------+------+-----+---------------------+-------+
3 rows in set (0.01 sec)
Here is the PK class (CardActionCardPK_Roo_Identifier.aj) generated by Roo during DBRE:
Code:
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package com.foo.backoffice.model;
import com.foo.backoffice.model.CardActionCardPK;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
privileged aspect CardActionCardPK_Roo_Identifier {
declare @type: CardActionCardPK: @Embeddable;
@Column(name = "cardActionId", nullable = false)
private Long CardActionCardPK.cardActionId;
@Column(name = "cardId", nullable = false)
private Long CardActionCardPK.cardId;
@Column(name = "cardActionDate", nullable = false)
@Temporal(TemporalType.DATE)
@DateTimeFormat(style = "M-")
private Date CardActionCardPK.cardActionDate;
public CardActionCardPK.new(Long cardActionId, Long cardId, Date cardActionDate) {
super();
this.cardActionId = cardActionId;
this.cardId = cardId;
this.cardActionDate = cardActionDate;
}
private CardActionCardPK.new() {
super();
}
public Long CardActionCardPK.getCardActionId() {
return cardActionId;
}
public Long CardActionCardPK.getCardId() {
return cardId;
}
public Date CardActionCardPK.getCardActionDate() {
return cardActionDate;
}
}
The generated annotation for the cardActionDate member should be TIMESTAMP, not DATE.
Is the team already aware of this code-generation issue?
In a previous thread that I started, and prior to me finding this problem, someone suggested I change the hibernate.hbm2ddl.auto property in persistence.xml from "validate" to "none". What negative side effects can this have? Is it going to a problem as we evolve the schema (I would think so). Is there another workaround that has been successful? Should I just change the generated code to use a temporal type of TIMESTAMP?
Thanks,
Jeff
-Jeff