@Override public void initialize(CreationTimestamp annotation, Class<?> propertyType) { if ( java.sql.Date.class.isAssignableFrom( propertyType ) ) { generator = new TimestampGenerators.CurrentSqlDateGenerator(); } else if ( Time.class.isAssignableFrom( propertyType ) ) { generator = new TimestampGenerators.CurrentSqlTimeGenerator(); } else if ( Timestamp.class.isAssignableFrom( propertyType ) ) { generator = new TimestampGenerators.CurrentSqlTimestampGenerator(); } else if ( Date.class.isAssignableFrom( propertyType ) ) { generator = new TimestampGenerators.CurrentDateGenerator(); } else if ( Calendar.class.isAssignableFrom( propertyType ) ) { generator = new TimestampGenerators.CurrentCalendarGenerator(); } else { throw new HibernateException( "Unsupported property type for generator annotation @CreationTimestamp" ); } }
@Temporal(TemporalType.TIMESTAMP) @Column(name = "create_date", nullable = false, updatable = false) @CreationTimestamp public Date getCreateDate() { return createDate; }