wood burning stoves*
The moose likes Object Relational Mapping and the fly likes JDO, Hibernate, Castor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JDO, Hibernate, Castor " Watch "JDO, Hibernate, Castor " New topic
Author

JDO, Hibernate, Castor

Anitha Lingam
Ranch Hand

Joined: Apr 21, 2002
Posts: 38
Hi,

I'm new to O/R Mappers. I would like to know more about JDO, Hibernate, Castor. Which is the best option? What are the advantages and disadvantages of each of these. How each of these differ from each other? What are the other alternatives?

Thanks.
Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

Unfortunately, I have little experience with JDO or Castor (read: none), though I've recently started using Hibernate after reading O'Reilly's Hibernate: A Developer's Notebook. I've found it fairly easy to use and quick to get going with.

There is a bit of a learning curve to switching over, and you kind of have to get used to the XML syntax needed to generate the mappings and Java, but beyond that, I've had few problems or complaints. (I suspect switching to any ORM tool requires a learning curve.) But as I said, it's been fairly flexible in all the ways I've needed it to be thus far, and it's fairly quick to use once you get used to it.
[ August 16, 2004: Message edited by: Theodore Casser ]

Theodore Jonathan Casser
SCJP/SCSNI/SCBCD/SCWCD/SCDJWS/SCMAD/SCEA/MCTS/MCPD... and so many more letters than you can shake a stick at!
Anitha Lingam
Ranch Hand

Joined: Apr 21, 2002
Posts: 38
Hi Theodore,

Thanks for your reply.
There are high chances of using JDO in our project. So would like to know more about JDO.
Moreover i learnt that JDO is a standard and it is portable while Hibernate is not.
What are the features available in Hibernate that is not available in JDO or vice versa.
Is it that developers started using Hibernate that they do not want to switch to JDO.

Thanks.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Comparison
http://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison


Groovy
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Old thread
http://www.coderanch.com/t/214766/ORM/java/Hibernate-vs-JDO
Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

Actually, I can't see any reason Hibernate isn't portable, since it's all Java-based. (There's nothing OS-specific in it.) But unfortunately, I don't know much about JDO, so I can't help you there, really.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Let me just add to the original question. All three are quite similar.
  • JDO is an object persistence standard - note that I did not say "O/R mapping standard". JDO is also geared towards persistence into object databases.
  • Hibernate is possibly the most popular Java O/R mapper. It is not JDO compatible, but arguably easier to use and more powerful than many JDO implementations.
  • Castor, in my experience, is a nearly-static product. Two years ago they were way ahead of the pack, but they've hardly moved since. I would not recommend it.
  • Originally posted by anitha lingam:
    Moreover i learnt that JDO is a standard and it is portable while Hibernate is not.
    True. It is up to you (or your managers) to judge how important that is. Avoid knee-jerk choices, though: JDO object-relational mapping is not standardised, just the programming model, so your JDO applications are more locked-in than you might think. Hibernate has a momentum that isn't that much smaller than that of JDO, and it is in more powerful and flexible in a number of ways. Not coincidentaly, the tool has made a definite impact on the of JDO 2.0 and EJB 3 standards-in-progress.

    What are the features available in Hibernate that is not available in JDO or vice versa.
    JDO is standard, and supports object databases. Hibernate is more mature, has a query language (HQL) which is more powerful and quite intuitive if you know SQL, does not require bytecode processing, and allows you to disconnect an object graph, update it in another tier and later reconnect it to persist the update.

    Is it that developers started using Hibernate that they do not want to switch to JDO.
    They believe that JDO represents an inferior product, and I don't think Gavin King was very impressed with the way the JDO 2 expert group is going.

    - Peter
    Anitha Lingam
    Ranch Hand

    Joined: Apr 21, 2002
    Posts: 38
    Thanks for all the replies.

    Basically I have the following requirements in my application.
    1. Object persistence
    2. Performance
    3. Database Independence

    Can I know how Hibernate/JDO caters to each of these requirements?

    Thanks.
    Pradeep bhatt
    Ranch Hand

    Joined: Feb 27, 2002
    Posts: 8919

    I dont know about performance (Hibernate guys say that it is scalable Hibernate is a powerful, ultra-high performance object/relational persistence and query service for Java. There are many implementations of JDO so performance could vary ) but other two requirements should be met by both Hibernate and JDO.

    The Hibernate idea will also be used in EJB 3.0.
    Anitha Lingam
    Ranch Hand

    Joined: Apr 21, 2002
    Posts: 38
    Regarding the portability with datasources, my application requires data to be written from the database to flat files and vice versa. Can this be acheived by both Hibernate and JDO?
    Eric Samson
    Greenhorn

    Joined: Sep 01, 2004
    Posts: 18
    Hi

    You can have JDO implementations for various data sources.
    That said, a product like LiDO already supports RDBMS, ODBMS, XML and it own light Java storage based on files.

    Best Regards, Eric.
    Pradeep bhatt
    Ranch Hand

    Joined: Feb 27, 2002
    Posts: 8919

    Originally posted by anitha lingam:
    Regarding the portability with datasources, my application requires data to be written from the database to flat files and vice versa. Can this be acheived by both Hibernate and JDO?


    Flat files? Hibernate doesn't work with flat files.
    Alexandru Popescu
    Ranch Hand

    Joined: Jul 12, 2004
    Posts: 995
    Originally posted by Peter den Haan:
    [...] All three are quite similar.[...]


    ... in intention (to be read persistence), while the target is quite different. While JDO spec aims to offer the generic solution for persistence (to any possible storage - I think this requires lots of guts), while ORMs target only to solve the so-called object-relational paradigm mismatch.

    /pope


    blog - InfoQ.com
    Christian Bauer
    author
    Ranch Hand

    Joined: Aug 31, 2004
    Posts: 45
    You can easily persist things to a file, e.g. use HSQL DB, which uses a single text file to hold the database. In Hibernate, you could have two SessionFactories (one for your normal RDBMS and one for HSQL DB) and then load and persist object graphs between them.

    XML is just the same as flat files, after all, its just a text file format. There is no real reason why it should be used for data storage and data management.


    Co-Author of <a href="http://www.manning.com/bauer" target="_blank" rel="nofollow">Hibernate in Action</a>
    Pradeep bhatt
    Ranch Hand

    Joined: Feb 27, 2002
    Posts: 8919

    http://www.versant.com/index.php?module=vregister&eventid=13&src=SBGG094
    Christian Bauer
    author
    Ranch Hand

    Joined: Aug 31, 2004
    Posts: 45
    It's a sales-seminar. I wouldn't want to attend that
    Pradeep bhatt
    Ranch Hand

    Joined: Feb 27, 2002
    Posts: 8919

    Originally posted by Christian Bauer:
    It's a sales-seminar. I wouldn't want to attend that


    Looks like they want to promote JDO.
    Thomas Whitmore
    Ranch Hand

    Joined: Aug 05, 2004
    Posts: 33
    Hi Anitha,

    There's a lot of interest in Java and object-database connectivity at the moment.

    (sentence removed by Mark Spritzler)

    * JDO data transfer is compiled, = fast.
    * True OO query; no more SELECT... FROM WHERE pseudo sql.
    * 100% reliable & more flexible identity handling.
    * Java standards portability.
    * etc.

    > There are high chances of using JDO in our project. So would like to know
    > more about JDO.

    Well, it's certain that JDO would be good, if you've got budget for your project. Commercial impls are robust & powerful these days.

    (Sentence removed by Mark Spritzler

    Effectiveness of development is really what you get, with JDO or o/r technology. It's just so much simpler & easier developing apps... I think you'll like it.

    > Is it that developers started using Hibernate that they do not want to
    > switch to JDO.

    (Sentence removed by Mark Spritzler)

    (Last paragraph remove by Mark Spritzler)

    Cheers,
    Thomas Whitmore
    www.powermapjdo.com
    [ September 11, 2004: Message edited by: Mark Spritzler ]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: JDO, Hibernate, Castor