-->
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.  [ 2 posts ] 
Author Message
 Post subject: Refresh doesn’t reflect changes of other users
PostPosted: Tue Sep 22, 2009 4:15 am 
Newbie

Joined: Tue Sep 22, 2009 3:43 am
Posts: 4
We have an 2 tier application with Swing and Hibernate (3.3.2.GA) on the client side and MySql on the servers side.
The application shows all objects (class network) in a tree component. To work with an network object the user selects the tree node.
To reflect changes by other useres we use "getSession().refresh(obj);" when the object was selected in the GUI.

Refreshing objects of the class network doesn’t work.

Code:
<class
    name=".."
    table="network"
>
...
    <!-- bi-directional one-to-many association to IpAddress -->
    <set
        name="ipAddresses"
        lazy="true"
        inverse="true"
      cascade="all"
    >
...
</class>
<class
    name="..."
    table="ip_address"
>
...
    <many-to-one
        name="network"
        class="de.unikoeln.rrz.uklanadmin.model.entities.Network"
        not-null="true"
        lazy="false"
    >
...
</class>


I think the problem is the outer join generatet by hibernate: select network0_.net_id ... outer join ip_address ipaddresse1_ on network0_.net_id=ipaddresse1_.net_id where network0_.net_id=?

The persister returns the first element of the resultset containig the changes in the database but dosent refresh the object.

Object result = persister.load( id, object, event.getLockMode(), source );

How can we ensure to refresh our network objects?

Thx, Michael


Last edited by MLoe on Tue Sep 22, 2009 6:44 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Refresh dosen't reflect changes of other users
PostPosted: Tue Sep 22, 2009 5:05 am 
Newbie

Joined: Tue Sep 22, 2009 3:43 am
Posts: 4
Changing the cascade attribute from cascade="all" to cascade="save-update" solves my problem:
Code:
...
    <!-- bi-directional one-to-many association to IpAddress -->
    <set
        name="ipAddresses"
        lazy="true"
        inverse="true"
        cascade="save-update"
    >
...

But I'm not really sure, what this change means to our application.
Can anyone give me a hint?


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

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.