• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring and JDO

 
Emman lopez
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matt,
I would like to know when deciding for a persistence framework which is better to use with Spring , JDO or Hibernate. My company is using struts and JDO right now, I would like to suggest spring to my boss, but I am a spring newbie. any advice ........

thanks in advance.
 
Matt Raible
author
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have experience with JDO, I'd stick with JDO. Spring has good support for JDO and it's quite easy to create a JDO DAO. Here's some examples from Chapter 7 - comparing a Hibernate DAO and a JDO DAO.

JDO Version:


Hibernate version:


In the book, I use JPOX and it's (early) JDO 2.0 support.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Matt already pointed out the solution is pretty much the same, so I think that you must continue with JDO - at least for the fact you already have knowledge of it and you already evaluate it.

./pope
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have experience with JDO, I'd stick with JDO. Spring has good support for JDO and it's quite easy to create a JDO DAO. Here's some examples from Chapter 7 - comparing a Hibernate DAO and a JDO DAO.


What is/are different between JDO and Hibernate?

When to use JDO/Hibernate?

thank you.
 
Matt Raible
author
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by somkiat puisungnoen:


What is/are different between JDO and Hibernate?

When to use JDO/Hibernate?


The main difference is that JDO is a "standard" while Hibernate is a widely successful open source project. It's similar to JSF and Struts. The standards tend to get adopted by large companies while the open-source projects have often proved their worthiness by usage.

When to use one or the other? That really depends on your company and your project. I prefer to use Hibernate on my projects, but when an O/R mapping tool doesn't work, I use iBATIS, which allows me to write SQL. Spring has supporting classes for iBATIS too. And, of course, it's covered in the book.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I prefer to use Hibernate on my projects, but when an O/R mapping tool doesn't work, I use iBATIS, which allows me to write SQL.


I guess you know you can write SQL in Hibernate too. I am wandering what do you mean by doesn't work? (it is a matter of scalability, performance, etc?).

./pope
 
Matt Raible
author
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ali Pope:


I guess you know you can write SQL in Hibernate too. I am wandering what do you mean by doesn't work? (it is a matter of scalability, performance, etc?).


I was on a project last year where we needed to migrate an existing JDBC app to something a little cleaner. The SQL statements in the Java code where enourmous and sometimes joined 5 or 6 tables. By using iBATIS, we were able to simply pull the SQL out of Java classes and put them in XML.

As for writing SQL with Hibernate, that's new and wasn't available at the time. In my experience, it's best to choose your persistence framework for what it's good at. Hibernate shouldn't be the hammer than solves all your problems. There are many other excellent frameworks out there.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt about choosing the best suitable solution I fully agree with you.

I was not quite sure what you meant by Hibernate not working (...and I am not a Hibernate advocate either ).

These tones of SQL bothers me from time to time. I would like to see a solution where your queries are compile time checked (the Criteria work on Hibernate is a good start for this).

./pope
 
Emman lopez
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for your input, I hear everyone talking about hibernate, I guess it should be very very good.
 
Emman lopez
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am planning to use Kodo JDO implementation, I wonder if they are thinking to create libraries for Spring, also I heard IntelliJ IDEA IDE were planning to have support for Spring Framework, anyone knows if they are going to release it soon?
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by Kodo libraries for Spring?
I don't know about a Spring plugin in Idea, but I can tell you that such a plugin is already available for Eclipse .

./pope
 
Matt Raible
author
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Emman lopez:
I am planning to use Kodo JDO implementation, I wonder if they are thinking to create libraries for Spring, also I heard IntelliJ IDEA IDE were planning to have support for Spring Framework, anyone knows if they are going to release it soon?


Spring's
JDO Support classes are not implementation specific, so what works with one implementation of JDO should work with another. The nice thing about Kodo and JPOX is they've each published sample apps or tutorials of how to use Spring with their products.

Kodo JDO + Spring Sample
JPOX and Spring Tutorial
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic