-->
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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate and Swing would it work?
PostPosted: Thu Feb 28, 2008 9:10 pm 
Newbie

Joined: Thu Feb 28, 2008 8:21 pm
Posts: 10
Hello:

I am doing research on combining Swing and Hibernate in a Java desktop app.
My requirement is very simple, we have a database with about 30 tables and I need
to create CRUD (Create, Read, Update and Delete) forms ASAP.

I have experience doing SWING to JDBC using hand coded SQL statements and
I have some experience using Hibernate in a 3 tier Web app.

What is your opinion? Can Hibernate be used behind a Swing app to eliminate the
joy of writing the SQL by hand?

Thank you for your attention to this matter

Best Regards

kd


Top
 Profile  
 
 Post subject: Re: Hibernate and Swing would it work?
PostPosted: Thu Feb 28, 2008 9:15 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Definitely.



Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 28, 2008 11:03 pm 
Newbie

Joined: Thu Feb 28, 2008 8:21 pm
Posts: 10
are there any samples? anywhere.

kd


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 28, 2008 11:08 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
kbd wrote:
are there any samples? anywhere.

kd



I don't know any samples but you can think of a simple DAO layer over a hibernate session or a mix with Spring.



Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 29, 2008 3:44 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
Of course it works with swing.

The problem you might encounter is that of handling sessions.

In a web application a unit of work (i.e. a session) is most of the time simply identified by a single request. There are well known, easy to implement solutions to that problem.

In a rich client application this is different.

You might open a list of objects, which need a Session for lazy loading.

You might start Editor like Windows from that list for manipulations of these objects. But now you start getting issues with the session handling.

My recommendation is to essentially use a Session per Dialog. And reload any Object in the Session of the target Dialog, when it gets passed from one Dialog to another.

I described the sessionhandling in rich client applications in a german blog article. It includes a list of relevant links at the end, which describe the problem of session handling in rich client applications.

Jens

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject: Swing and Hibernate
PostPosted: Fri Feb 29, 2008 10:49 am 
Newbie

Joined: Thu Feb 28, 2008 8:21 pm
Posts: 10
This is very very helpful.

Please note my requirement is very simple, CRUD forms for about thirty tables. There will be at max six users.

The only thing I could see the users doing across sessions would be two users deleting the same record or two users attempting to add the same record.

What would hibernate do in this case?

Many thanks

kd


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 11:24 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
Check the documentation for optimistic locking.

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 14, 2008 12:57 pm 
Beginner
Beginner

Joined: Fri Jun 25, 2004 11:47 am
Posts: 34
christian wrote a demo apps for swing. I think it's a point to start.
http://in.relation.to/Bloggers/HibernateAndSwingDemoApp


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 28, 2008 6:45 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
I wrote a englisch version of my blog post session handling in two tier rich client applications mentioned above.

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


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