Here is the background: I have an annotated @Embeddable
Java class that has a GregorianCalendar
field. I am attempting to use hibernate3:hbm2ddl to generate a schema via the hibernate3 Maven plugin so that I can persist another object into which this is embedded, but it runs into an error regarding the use of @Temporal
.
Here is the embeddable class:
@Embeddable
public class OperationalStatus implements Serializable {
.
.
.
/**
* Recorded date/time that the status value is valid
*/
private GregorianCalendar time;
/**
* No-argument constructor.
*/
public OperationalStatus() {}
.
.
.
/**
* @return the time
*/
@Temporal(TemporalType.TIMESTAMP)
public GregorianCalendar getTime() {
return time;
}
/**
* @param time the time to set
*/
public void setTime(GregorianCalendar time) {
this.time = time;
}
}
And here is the error readout:
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm 2ddl (default-cli) on project STRIPES_V2: Execution default-cli of goal org.code haus.mojo:hibernate3-maven-plugin:2.2:hbm2ddl failed: @Temporal should only be s et on a java.util.Date or java.util.Calendar property: stripes.datamodel. util.OperationalStatus.time
Here are some excerpts from the pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
<componentProperties>
<drop>false</drop>
<configurationfile>src/main/resources/hibernate.cfg.xml</configurationfile>
<outputfilename>schema.sql</outputfilename>
</componentProperties>
</configuration>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1000.jdbc4</version>
</dependency>
</dependencies>
</plugin>
.
.
.
<dependency>
<groupId>org.hibernate</groupId>
<version>4.1.7.Final</version>
<artifactId>hibernate-core</artifactId>
</dependency>
What am I missing? GregorianCalendar is a concrete extension of Calendar, so what's wrong?