Hibernate Annotation中的@Proxy

时间:2015-03-03 07:29:50

标签: hibernate proxy

@ Proxy(lazy = false)在hibernate注释中是什么意思?

   @Entity
@Table(name="addresses")
@Proxy(lazy=false)
public class Address {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="adid")
    private int adid;

    @Column(name="street")
    private String street;

    @Column(name="city")
    private String city;

    @Column(name="state")
    private String state;
//Constructor, getter and setter methods
}

请任何人向我解释这个概念

2 个答案:

答案 0 :(得分:1)

@Proxy(lazy = false)将禁用默认的延迟加载。这意味着无论何时引用此实体,您都将始终获得初始化实体。

答案 1 :(得分:0)