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

项目:lams    文件:CreationTimestampGeneration.java   
@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" );
    }
}
项目:spring-boot-blog    文件:Comment.java   
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "create_date", nullable = false, updatable = false)
@CreationTimestamp
public Date getCreateDate() {
    return createDate;
}
项目:spring-boot-blog    文件:Post.java   
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "create_date", nullable = false, updatable = false)
@CreationTimestamp
public Date getCreateDate() {
    return createDate;
}