Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Store Java object in MySQL Database

 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to store and retrive Java object in MySQL database.

How can I do that?

Is there any samlpe code?

Reg,
Chetan
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to read about JDBC.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and object serialisation.
 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chetan Parekh:
I want to store and retrive Java object in MySQL database.

How can I do that?

Is there any samlpe code?

Reg,
Chetan


Hello Chetan,
This can be done in multiple ways but i can tell you one approach for the same.You can use JDO i.e. Java Data Objects API and call its methods to store and retrive java objects as it is in any database, be it MYSQL.I have done this using JDO .I used Castor JDO for the same.I hope its fine by you.You can visit site of Castor JDO and see more details there.

Alternatively you can use CMP i.e. Container manager persistence featired offered by EJB.

These days hibernate is another OR mapping tool which you can for object persistence.

Saurabh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic