Hi, just started to use hibernate.
I have a problem with a field with type timestamp.
I use a DB2 database.
I get this error :
Caused by: net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of dk.te.deb.pojo.Player.draft_date
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:68)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:229)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2224)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:319)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:309)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
my setter method lookes like this :
/**
* @hibernate.property
* column="DRAFT_DATE"
* type="timestamp"
* not-null="false"
* unique="false"
* insert="true"
* update="true"
*
* @return Returns the draft_date.
*/
public Timestamp getDraft_date() {
return draft_date;
}
/**
* @param draft_date The draft_date to set.
*/
public void setDraft_date(Timestamp draft_date) {
this.draft_date = draft_date;
}
the Timestamp is a java.sql.Timestamp.
The sql that is genereated to create the table is :
create table PLAYER (
PLAYER_ID bigint not null generated by default as identity,
draft_date timestamp not null,
TEAM_ID bigint,
ANNUAL_SALARY float,
FIRST_NAME varchar(20) not null,
JERSEY_NUMBER integer not null,
LAST_NAME varchar(20) not null,
primary key (PLAYER_ID)
);
|