-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate retrieving dirty object
PostPosted: Wed Nov 19, 2014 12:39 pm 
Newbie

Joined: Wed Nov 19, 2014 12:31 pm
Posts: 2
I'm facing problems with hibernate that sounds to be related to object caching.

Destilling the problem, I have an entity, lets call it A, with a list attribute mapped with @OneToMany(cascade=CascadeType.ALL, mappedBy="attribute"). The objects on the list are entities of class B and has a bidirectional relationanship with A. So B has an attribute that points to A mapped with @ManyToOne(cascade=CascadeType.MERGE). I get the object A from database and add a new object B to A's list and call session.update(A).

The problem emerges when I get all A objects calling session.createCriteria(A.class).list();, access exactly the A object I updated and the B object I added is NOT present in the list SOMETIMES.

I tried to call session.refresh(A) after update A, but the problem still persists.

Does anyboy know how to deal with it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.