2014-02-10 48 views
1

我有一個域項目得到錯誤,同時增加(取= FetchType.EAGER)

public class Item { 
    @Id 
    @GeneratedValue(strategy = GenerationType.AUTO) 
    private int id; 


    @ManyToOne(optional = false) 
    private EUser itemOwner; 
    @ManyToOne(optional = false) 
    private ProductSubCategory productSubCategory; 




    @Column(nullable = false) 
    private String name; 
    private String model; 
    private Date dateReleased; 
    private String Description; 
    @Column(nullable = false) 
    private Double itemPrice; 
    @OneToMany 
    private List<Picture> pictures; 
} 

如果我把它@OneToMany服務器沒有問題

運行,但如果我這樣做

@OneToMany(fetch=FetchType.EAGER) 
private List<Picture> pictures; 

服務器崩潰,出現以下錯誤日誌

http://pastebin.com/6GW2bxwS

我需要(fetch=FetchType.EAGER)

如何解決這個問題?

+0

你有一個以上的渴望收藏? –

+0

是的,我在'EUser'域有一個。 – user2729183

+0

只要在這裏發佈錯誤日誌,如果你把東西放在外部網站上,那麼企業防火牆後面的任何人都可能看不到它。 – Gimby

回答

1

嘗試使用:

@LazyCollection(LazyCollectionOption.FALSE) 
@OneToMany 
private List<Picture> pictures;