Java 类org.hibernate.annotations.UpdateTimestamp 实例源码

项目:lams    文件:UpdateTimestampGeneration.java   
@Override
public void initialize(UpdateTimestamp 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 @UpdateTimestamp" );
    }
}