openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgarret <RGAR...@co.pierce.wa.us>
Subject Lazy loading not working.
Date Wed, 03 Oct 2007 16:35:48 GMT

Hello,

I am have several fields that are being eagerly loaded when they should not
be. Here's a simple example to illustrate my problem:

public class Test {

  private TestEnumeration testEnum; // TestEnumeration is an enumeration (go
figure)

  private TestBean testBean; // TestObject is just a regular bean

  @ManyToOne( fetch = FetchType.LAZY )
  @Column( name = "test_enumeration_id", nullable = false )
  public TestEnumeration getTestEnum( ) {
    return testEnum;
  }

  @OneToOne( cascade = CascadeType.ALL, fetch = FetchType.LAZY )
  @JoinColumn( name = "test_bean_id", nullable = false, updatable = false )
  @ForeignKey
  public TestBean getTestBean( ) {
    return testBean;
  }

}

I have made certain that neither testBean nor testEnum are in any active
fetch groups and yet they are still eagerly fetched. According to my logs
they are not fetched due to being accessed, rather, they are pulled
immediately as if they were in a fetch group or declared eager. 

I do not have this issue with collections (OneToMany) and if in the above
example I change the annotation on testEnum from
@ManyToOne(fetch=FetchType.LAZY) to @Basic(fetch=FetchType.LAZY) it behaves
properly.

In summation, all of my non-collection joined fields seem get fetched
eagerly despite being defined as lazy and not being in any active fetch
group. 

Am I doing something wrong or is this a bug?

Thanks!
-Reece
  
  




-- 
View this message in context: http://www.nabble.com/Lazy-loading-not-working.-tf4562936.html#a13022684
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message