Hibernate的一个注释 @Transient

@Transient表示该属性并非一个到数据库表的字段的映射,ORM框架将忽略该属性.
如果一个属性并非数据库表的字段映射,就务必将其标示为@Transient,否则,ORM框架默认其注解为@Basic
    示例:
    //根据birth计算出age属性
    @Transient
    public int getAge() {
    return getYear(new Date()) - getYear(birth);
    }

Could not find a setter for property resultTime in class com.lottery.analysis.entity.lottery.keno.bjkl8.Bjkl8IssueData

at org.hibernate.property.BasicPropertyAccessor.createSetter(BasicPropertyAccessor.java:240)

at org.hibernate.property.BasicPropertyAccessor.getSetter(BasicPropertyAccessor.java:233)

at org.hibernate.mapping.Property.getSetter(Property.java:299)

at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertySetter(PojoEntityTuplizer.java:307)

at org.hibernate.tuple.entity.AbstractEntityTuplizer.(AbstractEntityTuplizer.java:142)

at org.hibernate.tuple.entity.PojoEntityTuplizer.(PojoEntityTuplizer.java:78)


... 112 more

 

你可能感兴趣的:(Hibernate)