persistence@glassfish.java.net

Re: delay in ManyToOne relationship updates

From: Wouter van Reeven <wouter_at_van.reeven.nl>
Date: Thu, 24 Sep 2009 15:27:55 +0200

Hi,


Make sure to add the item to the Father's list before you persist the
item by calling

father.getItems().add(item);


HTH, Wouter van Reeven

On Thu, Sep 24, 2009 at 06:18:03AM -0700, josu wrote:
>
> Hello.
>
> I am developping an application using Toplink 2.0.1 persistence and
> Glassfish 2.1.
>
> I have an entity with a OneToMany/ManyToOne relationship to itself (an
> article can have a single father-article, and a father can have several
> item-articles), defined like this:
>
> @Entity
> public class Article implements java.io.Serializable, java.lang.Comparable{
>
> ...
>
> private Article father;
> private List<Article> items;
>
> ...
>
> @ManyToOne
> public Article getFather(){
> return father;
> }
>
> public void setFather(Article father){
> this.father=father;
> }
>
> @OneToMany(mappedBy="father")
> public List<Article> getItems(){
> return items;
> }
>
> public void setItems(List<Article> items){
> this.items=items;
> }
> }
>
> There are more properties in the entity but i don't mention them as they
> aren't relevant.
>
> The issue is that when I set an article's father, father's item list is not
> updated inmediatly. In fact, I don't get it updated until I restart
> Glassfish.
>
> How could I force that update be made inmediatly?
>
> Thanks.
> --
> View this message in context: http://www.nabble.com/delay-in-ManyToOne-relationship-updates-tp25567844p25567844.html
> Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.

-- 
Lime and limpid green a second scene,
A fight between the blue you once knew.
Floating down the sound resounds
Around the icy waters underground
[Pink Floyd - Astronomy Domine]
Skype: wvreeven
Facebook: wvreeven
Twitter: wvreeven