类org.hibernate.annotations.LazyCollectionOption源码实例Demo

下面列出了怎么用org.hibernate.annotations.LazyCollectionOption的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: aws-photosharing-example   文件: User.java
@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;}
 
源代码2 项目: aws-photosharing-example   文件: Album.java
@OneToMany(mappedBy = "album")
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Comment> getComments() {return comment;}
 
源代码3 项目: aws-photosharing-example   文件: Album.java
@OneToMany(mappedBy = "album", orphanRemoval=true)    
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Share> getShares() {return shares;}
 
源代码4 项目: aws-photosharing-example   文件: Album.java
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)  
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "albums", cascade=CascadeType.PERSIST)    
public List<Media> getMedia() {return media;}
 
源代码5 项目: aws-photosharing-example   文件: User.java
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Media> getMedia() {return media;}
 
源代码6 项目: aws-photosharing-example   文件: User.java
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Share> getShares() {return shares;}
 
源代码7 项目: aws-photosharing-example   文件: User.java
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@OneToMany(mappedBy = "user", orphanRemoval=true, fetch=FetchType.LAZY, cascade=CascadeType.ALL)
public List<Album> getAlbums() {return albums;}
 
源代码8 项目: aws-photosharing-example   文件: Role.java
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy="roles")	
public Set<User> getUsers() {return this._users;}
 
源代码9 项目: aws-photosharing-example   文件: Media.java
@OneToMany(mappedBy = "media")
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Comment> getComments() {return comment;}
 
源代码10 项目: aws-photosharing-example   文件: Media.java
@OneToMany(mappedBy = "media", orphanRemoval=true)    
@LazyCollection(LazyCollectionOption.EXTRA)
public List<Share> getShares() {return shares;}
 
源代码11 项目: lams   文件: CollectionBinder.java
private void defineFetchingStrategy() {
	LazyCollection lazy = property.getAnnotation( LazyCollection.class );
	Fetch fetch = property.getAnnotation( Fetch.class );
	OneToMany oneToMany = property.getAnnotation( OneToMany.class );
	ManyToMany manyToMany = property.getAnnotation( ManyToMany.class );
	ElementCollection elementCollection = property.getAnnotation( ElementCollection.class );
	ManyToAny manyToAny = property.getAnnotation( ManyToAny.class );
	FetchType fetchType;
	if ( oneToMany != null ) {
		fetchType = oneToMany.fetch();
	}
	else if ( manyToMany != null ) {
		fetchType = manyToMany.fetch();
	}
	else if ( elementCollection != null ) {
		fetchType = elementCollection.fetch();
	}
	else if ( manyToAny != null ) {
		fetchType = FetchType.LAZY;
	}
	else {
		throw new AssertionFailure(
				"Define fetch strategy on a property not annotated with @ManyToOne nor @OneToMany nor @CollectionOfElements"
		);
	}
	if ( lazy != null ) {
		collection.setLazy( !( lazy.value() == LazyCollectionOption.FALSE ) );
		collection.setExtraLazy( lazy.value() == LazyCollectionOption.EXTRA );
	}
	else {
		collection.setLazy( fetchType == FetchType.LAZY );
		collection.setExtraLazy( false );
	}
	if ( fetch != null ) {
		if ( fetch.value() == org.hibernate.annotations.FetchMode.JOIN ) {
			collection.setFetchMode( FetchMode.JOIN );
			collection.setLazy( false );
		}
		else if ( fetch.value() == org.hibernate.annotations.FetchMode.SELECT ) {
			collection.setFetchMode( FetchMode.SELECT );
		}
		else if ( fetch.value() == org.hibernate.annotations.FetchMode.SUBSELECT ) {
			collection.setFetchMode( FetchMode.SELECT );
			collection.setSubselectLoadable( true );
			collection.getOwner().setSubselectLoadableCollections( true );
		}
		else {
			throw new AssertionFailure( "Unknown FetchMode: " + fetch.value() );
		}
	}
	else {
		collection.setFetchMode( AnnotationBinder.getFetchMode( fetchType ) );
	}
}
 
 类所在包
 类方法
 同包方法