-->
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.  [ 7 posts ] 
Author Message
 Post subject: Remote db access from Swing app using Hibernate
PostPosted: Thu Oct 05, 2006 9:32 pm 
Beginner
Beginner

Joined: Mon Sep 05, 2005 4:48 pm
Posts: 31
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

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

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html

I need advice as to the best way to implement database access from a Swing Rich Client app to a remote MySQL database using Hibernate and a DAO Factory Structure.

The MySQL database will be running behind a firewall, so I was thinking that straight JDBC access from the Swing app would not be wise. One option I was considering was using JMX, exposing the DAO functions from an MBean which would run on a box behind the same firewall where the database server resides. Using basic RMI calls, this should work fairly well. But is it necessary?

Any recommendations?

Thanks!

M


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 9:56 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
I do not think that exposing your mysql database to the internet is wise, even if using https as a transport.

A middle layer has lots of advantages including some very basic ones like:

1. enforce login using user scheme that is not dependent on mysql and you can define privileges that make sense to your application
2. caching
3. database data modified in consistent way
4. very likely less chatty protocol
5. ability to add more mid tier servers if some of the API becomes CPU bound
6. ability to add more database servers (possibly read-only) if one server cannot take the load

There are multiple possibilities to do remoting, Spring's capabilities are pretty nice and you can use some of the third party libraries standalone. Those are pretty light in terms of configuration and usage.

http://www.springframework.org/docs/ref ... oting.html

You can also define your own XML, json or go for some of the heavier stuff SOAP and so on ... lots of good stuff out there.


Marius


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 10:32 pm 
Beginner
Beginner

Joined: Mon Sep 05, 2005 4:48 pm
Posts: 31
Thanks Marius. I was actually considering Spring also and will take a look at the link you mentioned. What do you think about JMX as a solution?

Mark


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 12:34 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Mark,

I think JMX is great for management/monitoring ... where would you use this in your application? All the way to the Swing client? This seems appropriate if the application is mostly a monitoring application, but I do not know if it's worth using as a general communication protocol.

In my experience remoting itself is not as big of an issue as selecting API with the proper granularity given the bandwidth, client hardware, transaction requirements and other.

It's hard to give good advice, even more so if not enough details are known :)

Good luck,

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 9:12 pm 
Beginner
Beginner

Joined: Mon Sep 05, 2005 4:48 pm
Posts: 31
Marius:

A friend and I recently had a discussion regarding remote access from a Rich Client app, Swing in this case, and JMX came up as a viable solution. Based on my experience w/JBoss, which is basically just a big MBean server, the JMX approach seemed worth investigating.

However, I have not found any references to anyone using JMX outside of the Management context. So, based on your suggestion, I did a little research into a Spring solution and believe that the Http invoker remoting solution shows promise.

In my situation, it seems unlikely that the majority of the customers using the Swing client to access a database behind their firewall would be willing to open up the necessary ports to allow RMI access, so it looks like the Http invoker approach seems like a good idea. It was suggested to me that a direct JDBC connection to, in this case, a MySQL instance at, say, port 3306, may be acceptable based on the use of someting like IpSEC to provide security. But I find it hard to believe that any fortune 100 company would allow this. That is why I am pushing the web services approach, i.e. Http invoker.

I usually don't develop systems where Rich Clients access central databases in this manner. Usually it is in the form of a Web/J2EE app. Any suggestions or experience you have would be appreciated.

Regards,

Mark


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 5:15 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Mark,

All your experience from J2EE applies in this scenario to. You still have a web/j2ee server. It's just that instead of displaying information in html,xml,pdf format you are sending objects to a custom (and probably more complex) browser. One plus is that you can and should have stateless interactions between the rich client and the web server, this will allow you to scale.

Good luck :)

Marius


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 12, 2006 1:00 pm 
Beginner
Beginner

Joined: Mon Sep 05, 2005 4:48 pm
Posts: 31
Actually, a web/j2ee component on the server is not a requirement. However, w/Spring Remoting, whether I use Hessian/Burlap or Http Invoker, I was thinking that setting up a Tomcat or Resin server, or even Jetty, and deal with it that way.

Another option presented was using RDBMS specific SSL/SSH wrappers around the connection. MySQL, for instance, has built in yaSSL in v.5.0.10 and above, but I am not sure this would work using Hibernate. And, again, would exposing the db directly to the internet, SSL/SSH included, be more practical or secure than the Spring Remoting implementation? I would say no.

Mark


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