| Joined: Fri Feb 03, 2006 3:42 pm
 Posts: 4
 Location: Manassas, VA USA
 | 
				
					| I have a top level class where all OneToOne annotations have (fetch=FetchType.LAZY).  This sort of works as advertised.  Each association is populated by a separate query.  Unfortunately the query is run for each top-level object loaded regardless of whether the associated property is accessed.
 The following annotation in the Person class:
 
 @OneToOne(
 cascade = CascadeType.REMOVE,
 fetch = FetchType.LAZY
 )
 @PrimaryKeyJoinColumn
 private ContactInfo contactInfo;
 
 Yields the following hibernate queries for Person and ContactInfo, even though ContactInfo hasn't been accessed.
 
 Doing the same thing with ManyToOne (fetch=FetchType.LAZY) on other properties and it works as expected.  The query is run only when the associated property is accessed.
 
 Using Hibernate 3.1.2, EntityManager 3.1beta6, Annotations 3.1beta8.
 _________________
 Bill Squires
 
 
 |  |