[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Not retreiving OneToMany collections with lazy and eager option
|
Hi Christopher,
Here is my code.
The Application is parent entity which has collection OneToMany of
ApplicationRejectMap. The entity detail given below.
@Entity
@Table( name = "APPLICATION_TBL" )
public class Application {
@Column( name = "APPLICATION_ID", nullable = false, unique = true )
private Integer id;
@OneToMany( mappedBy = "application", fetch = FetchType.LAZY )
private Set< ApplicationRejectMap > appRejectMaps;
}
The child class ApplicationRejectMap details which as ManyToOne relation
with Application as mentioned beow.
@Entity
@Table( name = "APPLICATION_REJECT_MAP_TBL" )
public class ApplicationRejectMap {
@Column( name = "REJECT_MAP_ID" )
private Integer id;
@ManyToOne
@JoinColumn( name = "REJECT_APPLICATION" )
private Application application;
}
Do you think is there any issue on this?
Thanks,
Kiran
christopher delahunt wrote:
>
> Hello Kiran,
>
> From the sounds of it, the OneToMany is mapped by a OneToOne back
> pointer, and are maintaining relationship changes through the OneToOne
> but not the OneToMany. If you set one side of a bi directional
> relationship, the application must also maintain the other side as well
> or the cache becomes out of synch with what is in the database until a
> refresh occurs. Invalidating the objects is essentially forcing a
> refresh, which causes the OneToMany to be queried from the database.
>
> When you add/remove from a relationship, the application will also need
> to add/remove from the OneToMany collection as well.
>
> Best Regards,
> Chris
>
> On 22/11/2010 6:01 AM, Kiran Kumar Gubbi wrote:
>> Hi all,
>>
>> I am currently trying to improve performance of our application . One of
>> the
>> thing I wanted to use is lazy loading of oneToMany collections. But it
>> looks
>> like the data is not retrieved eventhough it is present in the database.
>> The
>> scenario is we upload the application form through web service, it
>> generates
>> the form data and if the form is not valid it generates rejection list
>> in
>> the database. On looking for this same form on our web application the
>> rejection list is not retrieved from the database. I have used fetch type
>> is
>> lazy for this collection. One thing we have noticed that after clearing
>> cache using the following code from the screen the rejection list start
>> appearing on the screen.
>> ( ( JpaEntityManager ) getEntityManager().getDelegate()
>> ).getServerSession(). getIdentityMapAccessor().invalidateAll();
>>
>> Is there something I am missing here ?
>>
>> My colleague observed even Eager fetching is not working .
>>
>> Thanks,
>>
>> Kiran
>>
>>
>>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>
>
--
View this message in context: http://old.nabble.com/Not-retreiving-OneToMany-collections-with-lazy-and-eager-option-tp30277461p30279022.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.