JDO, or O/R

February 3rd, 2003

I'm currently looking for a solution to the Persistence Problem. Revisiting the O/R problem yet again. Currently, we're having a mechanism based on Value Objects and Data Access Objects which works quite well, except for the fact that it's a nightmare performance wise. In order to improve performance, we're writing custom Connection wrappers, parsing and reparsing statements to make them Prepared Statements, etc etc. Every improvement creates some "we have to remember to do that with new objects in the future", each of which can be easily forgotten and which omitment is not readily noticed.

An added complexity is that we need a system that works as good for batch processing (thousands of records at once, loaded from files) as for "online" processing (one at a time, with a user sitting at a screen), without copying all the business logic. It's easy to build a system that works A-OK for either, but not for both.

So somebody pointed me to JDO. It seems to be a good replacement for our DAO layer. Map your objects to a DB without too much complexity. But I'm quite hesitant: will it solve our performance problems? Will it be as easy to convert our application as it looks? Even worse: if we decide to go for JDO, do we need Sun's JDO spec, or is Castor's better? Sun's spec doesn't seem to have a free implementation, which makes it riskier to invest in that option. I've heard a lot of good of Castor, but it was about it's XML serialization. Are they as good in O/R mapping? I'm looking into it, but real-life experience would be very welcome. I'm kind of searching around in the dark, with a flashlight that only reveals positive points.

7 Responses to “JDO, or O/R”

  1. Tim Says:
    Take it from someone who's been there. Castor's O/R stuff is one ugly mofo. Go with Hibernate instead.
  2. Doamgoj Says:
    Well currently two best open source Java OR mappers are Hibernate and Apache Jakarta OJB. I think Hibernate is easier to learn and setup, and it's more mature , I mean less hasstle to make it work, and OJB is more powerfull but more hassle to make it work, plus they are planning an JDO compatible layer over their engyine, for now you have ODMG API and their own PersistanceBroker API. see : http://hibernate.bluemars.net/ http://jakarta.apache.org/ojb/
  3. Steve Conover Says:
    I agree with the above, Hibernate and OJB are the best out there...though having protoyped with both and keeping up with the updates, at this point I'd have to say go with Hibernate. There are some nice extra features you get with OJB, but I've found the ramp-up with Hibernate to be much smoother and faster than OJB - the Hibernate docs are MUCH better than OJB's, and I haven't hit undocumented snags in Hibernate like I seem to do with OJB... Also, forget about specs. You can easily abstract away from a given O/R mapper if you ever want to swap them out (given than your software has good unit test coverage and is well-factored). Hibernate gives you a solid O/R building block, which has a broad installed base and very active developer and user communities.
  4. ade Says:
    I don't know why more don't take a look at TriActive 's JDO at http://tjdo.sourceforge.net/. It's free and open source. It supports the JDO spec. What more could you want?
  5. Krishna Says:
    Check this also.. Cayenne is a powerful, full-featured OpenSource Object/Relational framework. Cayenne is written in Java and is intended for Java developers working with relational databases. http://objectstyle.org/cayenne/ - its also open source and free
  6. hugues sicotte Says:
    My application is that I have a database model, and I want to provide persistent java objects. My selection of 'best' depended on my requirements. The problem I had with Triactive JDO is that it has no respect for an existing Database model. It is designed to work from the Java Objects. Hibernate and cayenne look pretty good, but they are not JDO compliant. OJB is still has some problems with locking and is not JDO compliant yet. Hemisphere Technologies JDO Genie has all I need except I have to use a reverse-engineering tool code generator from some other projects. They have a free community license. Right now I am hesitating between Hibernate/cayenne or JDO Genie + Torque or java2sql or Xgen my requirements were sql to Java objects generation java objects persistence free. mysql and oracle support java 1.3 or higher support many-many relationship minimal amount of coding 'respect' my sql data model. standards-based here are a small piece of my notes (they are rough and tough) --Java Class generators for persistent storage to Database-- - Hibernate - not JDO compliant .. but is a great complete solution + reverse engineering from database. - Hemisphere Technologies JDO Genie - Free non-commercial Edition. +works on mySQL and oracle. +no runtime license +workbench GUI environment -no reverse engineering (need to use Torque or other reverse engineering tool before that) +oracle and mysql support (full support of 3.23 or higher as of JDO Genie 1.2.9 .. feb 2003) + tomcat support + M:M supported. - Jakarta OBJ apache object-relational bridge: db.apache.org/ojb/ status: release 1.0 JDO API not yet working well, ODMG 3.0 API working. includes low-level API for applications that don't need object level transactions. PersistenceBroker API to manage low-level persistence kernel. locking not quite working yet.. must do it in client. uses Torque to create tables and data .. must generate a Torque XML file to describe the tables. (must write a script) +designed to use only minimal subset of SQL to be max compliant. --- JDO not quite fully ready. - XORM ( http://xorm.org ) Open SOurce JDO compliantish. persistence-capable classes. does what I want (reverse engineer objects from DB .. but is still buggy .. JDOQL doesn't parse complex expressions well) - requires to write get/set "interface" methods .. is missing code generator for that. (not the actual code, just the prototypes) .. but on the + side this allows you to create abstract classes with additional helper methods beyond the data in the database. - Triactive JDO ( http://tjdo.sourceforge.net ) Open Source JDO compliant .. supposed to be most compliant. Designed to create database to save Java Objects --- not designed to generate data classes for existing databases. will generate it's own database tables.. and will produce different tables that given as input! - JORM Object Web http://jorm.objectweb.org/index.html +Open Source JDO Compliant? part of the JonAS Application server environment. +supported by INRIA -documentation not so great. -no reverse engineering. -get source code straight for CVS. (only tested on Linux) ---does not work with JDK 1.4 - Castor JDO code generator: Persistence through DAO pattern... or Entity Beans with BMP. ---- not Sun JDO compliant, but same concepts. - Oracle TopLink: WE may get it for Free at NIH. JDO compliant? (sort of, they have different names for the JDO methods) proprietary beans or straight interface. - best tool on the market. -need runtime library +free to us -might require license for deployment. -requires full J2EE compliant server., ---public DB users pay $7000/CPU !!!!! - Hibernate - not JDO compliant .. but has been simple and stable for 2+ years. - Cocobase .. $$$ - Describe (Embarcadero) - $$ ObjectFrontier FrontierSuite for JDO starting at $999/developper - no runtime fee. Poet FastObjects www.fastobjects.com/us/ website not responding two days in a row. PrismTech OpenFusion JDO http://www.prismtechnologies.com/ can no longer find the download. Signsoft IntelliBO - 30 day evaluation license. SolarMetric Kodo JDO - $600/developper eXcelon Javlin - cannot find info about that product on their website. JCorporate Expresso Framework Libelis LiDO - free community edition- Needs reload every 6 months. Object Industries JRelay - 30 day evaluation Versant enJin - 60 days evaluation - best tied to websphere.
  7. hugues sicotte Says:
    the posting tool removed all my formatting... sorry.

Leave a Reply