Hi,
I have 1 to n relation in my EntityBean(Company to Persons, JBoss 3.0 use CMR )
and there will have more than 10000 persons in one Company
when i create a person i will add to company
but i find JBoss will call SQL to find all Person when i get Collection
and it will wast a lot of time(in JDBC i just only set the foreign key, it is very fast)
code is like:
Company theCompany=CompanyHome.finByXX(...);
Person thePerson=PersonHome.create(...);
Collection thePersons=theCompany.getPersons();
//there will have a SQL call like-->
//SELECT primaryId from PERSON
//where PERSON.company = ?
thePersons.add(thePerson);
In JBoss (or EJB)
Is container always execute SQL when i get Collection??( there may be some setting i dont know)
or is there any other way can fast build the relationship ??
Thanks a lot
arich