-->
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: Process-scoped identity for a Swing application
PostPosted: Fri Jan 27, 2006 2:55 pm 
Regular
Regular

Joined: Wed May 11, 2005 11:57 pm
Posts: 80
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.05

Name and version of the database you are using: MySQL 4.1.16

We're about to set up persistence for a 2-tier Swing application that uses Hibernate to read and write from a MySQL database. This is a multi-user system, so we will need to heavily rely on versioning and pessimistic locking to ensure fresh data.

From posts on this forum, it sounds like a single session for the whole process is the best way to go, so that we can have process-scoped identity. Before we get started on the project, I'd like to ask a few questions here to make sure we don't get into trouble down the road.

1) The Hibernate docs state that all HibernateExceptions are fatal. In a single session model, what is the best way to handle these exceptions? We cannot simply reload the objects from the database, because we need to maintain process-scoped identity.

2) Assuming that we come up with a reasonable solution for #1, I have a specific question about the StaleDataException. If we call session.lock(object, LockMode.READ) and get a StaleDataException (which will happen quite often), can we safely just use refresh() to update our object, or do we need to consider this fatal?

3) Other than a HibernateException or running out of memory, are there any other cases where we need to close the session?

4) If we do a fetch from the database and we already have some of the resulting items as persistent objects in our session, are our persistent objects refreshed? If not, what happens? Do we simply discard the values from the database?


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.