-->
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.  [ 4 posts ] 
Author Message
 Post subject: Concurrenct with Proxies / Lazy initialization
PostPosted: Fri Oct 14, 2005 3:43 pm 
Newbie

Joined: Fri Feb 04, 2005 9:49 pm
Posts: 4
Hi

I just would like to know whether the following approach in working with proxies/lazy initialization is correct/possible:

1. Persistent objects are loaded by a worker thread. Collections are lazy="true"
2. The loaded object is passed to a SWING user interface
3. The UI accesses the object
4. The object is passed back to the worker thread which takes care of persitence details

When another thread (in my case the AWT event thread) than the one which initially loaded the object using Hibernate accesses a (lazy) collection, will there be possible problems?

I want all persistence details be done by the worker thread in order to keep the UI responsve. Or is there a way to have Hibernate generate synchronized collection proxies that are thread safe?


Thank you for any help
--Bruno

Hibernate version: 3.0.5

Mapping documents:
Code:
<hibernate-mapping package="ch.afp.data">
   <class name="Person" table="People">
      <id name="ID" type="long" unsaved-value="null">
         <column name="ID" not-null="true"/>
         <generator class="sequence">
            <param name="sequence">S_People</param>
         </generator>
      </id>

      <property name="lastName"  column="LastName"  not-null="true"/>
      <property name="firstName" column="FirstName" not-null="true"/>
      
      <!-- much more properties here -->

      <set name="businessTransactions" table="BusTxns" lazy="true" cascade="all-delete-orphan">
         <key column="PID"/>
         <one-to-many class="BusinessTransaction"/>
      </set>
   </class>
</hibernate-mapping>

Name and version of the database you are using: PostgreSQL 8[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 5:27 pm 
Beginner
Beginner

Joined: Thu Aug 11, 2005 5:19 am
Posts: 29
Quite usual schema...

Why don't you just try it out?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 7:29 pm 
Newbie

Joined: Fri Feb 04, 2005 9:49 pm
Posts: 4
If I just try it out it might work in my test cases, but fail in production. Thats why I prefer to know it exactly. Do you crash your car into a tree just to see whether the airbags work???


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 7:47 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
crashing your car might cost you a lot of time and money, taking Danny's advice might cost you two or three hours, if your new.

there is nobody on the forum that will be able to answer questions like "will there be possible problems" from afar.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.