天天看点

@Transient注解

@Transient注解

java注解:http://tool.oschina.net/apidocs/apidoc?api=javaEE6

javax.persistence 

Annotation Type Transient

@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface Transient      

Specifies that the property or field is not persistent. It is used to annotate a property or field of an entity class, mapped superclass, or embeddable class.

Example:

    @Entity
    public class Employee {
        @Id int id;
        @Transient User currentUser;
        ...
    }
       
Since:
Java Persistence 1.0

源自包:javax.persistence.Transient;

方法或属性级别的注解,该注解指定该属性不被持久化到数据库当中,通常用来标注该属性 对应一个实体类,映射超类或者嵌套类。