Mapping Objects to Relational Databases
Hi,
I do not know if this is the more suitable forum to ask this question, but I am going to try it:
I am developing an application with two parts.
1. A server developed in J2SE which is connected to a MySQL database.
2. A client developed in Swing which shows data received from the server by RMI.
Up to now, I map the relational database data in objects manually in the server side. But I would like to use a framework to do this (JDO, EJB 3.0, hibernate...).
I have read a lot about them, but I have serious doubts. Can I use them with J2SE? I think that it is necessary to use JBoss (or another application server) if I use EJB, it is true? Which is the easiest?
Which technology do you advice me?
I am very confused, thanks in advance.
# 1
> I am developing an application with two parts.
> 1. A server developed in J2SE which is connected to
> a MySQL database.
Interesting since the JDBC API is not part of J2SE. How do you connect to the database without using JDBC? If you are using JDBC, why are you so confused?
> 2. A client developed in Swing which shows data
> received from the server by RMI.
Again, the RMI API is not part of the J2SE. If you are truthfully writing RMI code, which is complex, and you are writing Swing code, and you may be writing JDBC code, why are you very confused?
> I have read a lot about them, but I have serious
> doubts. Can I use them with J2SE?
Did read a lot about them? Why do you have serious doubts? Did you understand what you read?
I suggest you read some more.
# 2
> since the JDBC API is not part of J2SE> RMI API is not part of the J2SE:huh: Yes they are.
# 3
Basically, if you use EJB-2 you'll need to use an "Aplication server", but Sun supplies one free. But I wouldn't consider EJB-2 for except for a very large project (and I'd loath it then).
Much of EJB-3 is derived from Hibernate. Certainly Hibernate provides the simplest configuration requirements, and because so much of EJB-3 is derived from hibernate if you use hibernate (with annotations) then it should serve you in good stead should you need to advance to an EJB-3 environment at some later time.
# 4
Maybe I am confused, but I think I have used them in J2SE5.0. You can check it in this web-page: http://java.sun.com/j2se/1.5.0/docs/Anyway, anybody can help me please?
# 5
> > since the JDBC API is not part of J2SE
> > RMI API is not part of the J2SE
>
> :huh: Yes they are.
No, you are incorrect.
The JDBC and RMI-IIOP APIs are part of the (formerly known as J2EE) Java EE set of APIs, not the Java 2 Standard Edition set of APIs.
We should make sure we have all of our fruits in their proper baskets :o)
# 6
> No, you are incorrect.
Erm, no. You are.
JDBC and RMI are both available in the core J2SE. How did you verify your assumption when mlk first pointed this out to you?
> We should make sure we have all of our fruits in their proper baskets :o)
Indeed. ;o)
~
# 7
> Maybe I am confused, but I think I have used them in J2SE5.0.
No, you're not confused. They're available in J2SE.
> Anyway, anybody can help me please?
Hibernate can be used in J2SE applications without additional frameworks. The use of EJBs for persistence requires an EJB container, such as JBoss, which you mentioned (there are others, of course).
~
# 8
>
> I have read a lot about them, but I have serious
> doubts. Can I use them with J2SE? I think that it is
> necessary to use JBoss (or another application
> server) if I use EJB, it is true? Which is the
> easiest?
Easy is relative. If the app is simple then, given that you have no experience with any of the mentioned technologies, then just jdbc is probably easiest. As the complexity goes up the balance might shift to one of the others.
You might note that at least as far as I know, hibernate is not a server. It is just a framework. While jboss is a server. Thus a solution with just hibernate would require that you would still have to create the server infrastructure. Tomcat is an alternative as well.
If you absolutely had to have EJB (which I doubt) then jboss would be your only possible solution (of those listed here.)
# 9
> JDBC and RMI are both available in the core J2SE. How
> did you verify your assumption when mlk first pointed
> this out to you?
When did this change occur?
What year and version of Java?
As far as Java 1.4, these API's were not part of the J2SE API's.
# 10
When did this change occur? What year and version of Java?
You seem reasonably intelligent. I have to assume you're capable of researching this...
> As far as Java 1.4, these API's were not part of the J2SE API's.
http://java.sun.com/j2se/1.3/docs/api/index.html
http://java.sun.com/j2se/1.3/docs/api/java/sql/package-frame.html
http://java.sun.com/j2se/1.3/docs/api/java/rmi/package-frame.html
~
# 11
> As far as Java 1.4, these API's were not part of the
> J2SE API's.
Well here is the link to the API for 1.3. It might go further back then that.
http://java.sun.com/j2se/1.3/docs/api/java/rmi/package-summary.html
http://java.sun.com/j2se/1.3/docs/api/java/sql/package-summary.html
What makes you say their not part of the API in 1.4?
# 12
> > JDBC and RMI are both available in the core J2SE. How
> > did you verify your assumption when mlk first pointed
> > this out to you?
>
> When did this change occur?
>
> What year and version of Java?
>
> As far as Java 1.4, these API's were not part of the
> J2SE API's.
I can't help but feel (or at least hope) that people are using different definitions for the acroynms.
JDBC and RMI was part of the Java API before version 1.1.4.
RMI specifically documents 1.1 as the version...
http://java.sun.com/j2se/1.5.0/docs/api/java/rmi/Remote.html
JDBC doesn't have a version which means that it was part of 1.0...
http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html
# 13
Thanks to all!! Your posts has been very usefull!!I think I will use hibernate, because EJB 3.0 requires an application server. And what about JDO? Can it be another posibility?Ah! A message for GhostRadioThree: Have you understood what you read? Now you are confused...