Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ActiveObject Eager Loading of objects

Francis Lavalliere September 3, 2015

Hello,

 

We have an active object class like this :

@Table("OBJECT_A")
public interface ObjectA extends RawEntity<Long> {
    ..
    ..
    public void setObjectB(Object b);
    public ObjectB getObjectB();
} 


@Table("OBJECT_B")
@Preload
public interface ObjectB extends RawEntity<Long> {

    ..
    ..
    public void setName(String n);
    public String getName();
}

 

 

We use an activeobject find method to find all Object's a and we would like to load all object B at the same time...

ObjectA[] o = (ObjectA[])ao.find(ObjectA.class, Query.select().where(where, params));
for(int i = 0; i < o.length; i++)  {
   System.out.println(o.getObjectB().getName());
    // AT EACH ITERATION A QUERY TO THE DATABAE IS MADE
}

 

Even if we used the @Preload  Annotation, it doesn't seems to do Eager Loading of the objects....

 

Anyone can give us input?

 

Regards.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Mark H_ Williams March 18, 2016

I'm having the same issue where the @Preload annotation doesn't seem to turn on eager loading.

TAGS
AUG Leaders

Atlassian Community Events