FetchType « Default « JPA Q&A





1. Java Hibernate with Persistence Question---if FetchType is not defined, what is the default method?    stackoverflow.com

Hi guys I am new to Hibernate and JPA I wrote some functions, initially, I set fetch = FetchType.LAZY in the entity class. But it gave me error: "org.hibernate.LazyInitializationException: could not initialize ...

2. Default FetchType    forum.hibernate.org

Hi, The reason why I am asking because right now we are porting from toplink to hibernate. In toplink the default behavior was the lazy loading but it seems that the hibernate by default does eager fetching. We would like to avoid to change it by putting an annotation on all the relations because we have a lot. thnx: BP

3. How to change the default FetchType to LAZY    forum.hibernate.org

Hi I am using the @ManyToOne association for the column join as shown below @ManyToOne(cascade = {}, fetch = FetchType.EAGER) @JoinColumn(name = "PROGRAM", unique = false, nullable = false, insertable = true, updatable = true) protected Program getProgram() { return this.program; } Almost all the class entities are using the same association. And i want to change the FetchType to LAZY. ...