I must be doing something wrong, because I really think that properties are lazy loaded.
Using Hibernate 3.2 CR1 with Annotations 3.1 beta9, properties on a normal entity are loaded only when I first access any of them.
Example:
Code:
@Table(name = "semantic_item")
@Entity
public class SemanticItem implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(name="CONTENT_MEDIA_ID")
private Integer contentMediaId;
@Column(name="NAME_KEY")
private String nameKey;
public SemanticItem() {}
//getters and setters
}
I load the class using:
Code:
SemanticItem semanticItem = (SemanticItem) session.load(SemanticItem.class, id)
If I close the session, and try to access any property of the object afterwards (without having done it before), I get a LazyInitializationException.
¿Maybe I am overriding the defaults somehow? ¿Is there any way to explicitly specify eager loading for all properties (without iterating through all of them)?
thanks