openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Eager fetching not working with enums and lobs
Date Fri, 06 Jul 2007 17:58:34 GMT

On Jul 6, 2007, at 10:52 AM, Patrick Linskey wrote:

> The spec doesn't seem to discuss it, but I think that lazy is a pretty
> good default behavior for @Lob field types -- typically @Lob things
> are big, so you often don't want them in the default fetch graph.

Enum is different, though. Enum should be eager fetching by default.

Lazy fetching is optional, so we can decide what we want to do. It  
seems that the existence of @Basic should not change our strategy.  
And we should default to lazy fetching for Lob and eager fetching for  
Enum.

Craig
>
> -Patrick
>
> On 7/6/07, Kevin Sutter <kwsutter@gmail.com> wrote:
>> I am finding that the supposed default action of Eager fetching is  
>> not
>> happening with @Enumerated and @Lob fields.  If I explicitly  
>> specify the
>> @Basic annotation, then the fields are eagerly fetched.  But,  
>> without this
>> extraneous @Basic, these fields are lazily loaded.  This action  
>> does not
>> seem to be consistent with the spec.  Nor, can I find any mention  
>> of this
>> alternate behavior in our OpenJPA manual.  Sounds like a bug to  
>> me.  Any
>> other insights?
>>
>> This works (eager loading kicks in):
>>
>>     @Basic @Enumerated(EnumType.STRING)
>>     private Gender gender;
>>
>> This does not work (lazy loading kicks in):
>>
>>     @Enumerated(EnumType.STRING)
>>     private Gender gender;
>>
>> I have also tried to use defaults (without any annotations), and lazy
>> loading still kicks in:
>>
>>     private Gender gender;
>>
>> Thanks,
>> Kevin
>>
>
>
> -- 
> Patrick Linskey
> 202 669 5907

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message