下面列出了org.hibernate.annotations.LazyCollectionOption#EXTRA 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@ManyToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
@JoinTable(name = "role_mappings", joinColumns = {
@JoinColumn(name = "user_id", nullable = false, updatable = false) },
inverseJoinColumns = { @JoinColumn(name = "role",
nullable = false, updatable = false) })
public List<Role> getRoles() {return _roles;}
@OneToMany(mappedBy = "album")
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Comment> getComments() {return comment;}
@OneToMany(mappedBy = "album", orphanRemoval=true)
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Share> getShares() {return shares;}
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "albums", cascade=CascadeType.PERSIST)
public List<Media> getMedia() {return media;}
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Media> getMedia() {return media;}
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Share> getShares() {return shares;}
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Album> getAlbums() {return albums;}
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="roles")
public Set<User> getUsers() {return this._users;}
@OneToMany(mappedBy = "media")
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Comment> getComments() {return comment;}
@OneToMany(mappedBy = "media", orphanRemoval=true)
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Share> getShares() {return shares;}