Thanks - works beautifully!

On 4/2/2009 2:38 PM, Pinaki Poddar wrote:
Hi,
Is there a way to tell if a lazily fetched Collection is already loaded without 
accessing the field and forcing it to load?

Yes. [1]

fetching a large collection may be expensive.

Check [2]. May be useful.

[1] http://n2.nabble.com/hibernate-conversion-items-tc2511309.html#a2521552
[2] 
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_dbsetup_lrs


I want to add a new persistent entity to a Collection, but only if the Collection has already been fetched - because fetching a large collection may be expensive. But once it has been fetched it must be kept it up to date in memory.

    @OneToMany(mappedBy="listHolder", fetch=FetchType.LAZY,
               cascade={CascadeType.PERSIST,CascadeType.REMOVE})
    private List<Member> memberList;







-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member

Reply via email to