Announcing Hibernate, Object/Relational Persistence Layer

Discussions

News: Announcing Hibernate, Object/Relational Persistence Layer

  1. Hibernate is a free (LGPL) object/relational persistence and query mechanism that lets you develop persistent objects following common Java idioms, including association, inheritence, polymorphism, composition and the Java collections framework. No code generation or bytecode processing is required. Instead, runtime reflection is used.

    Check out Hibernate.
  2. It is good to see an emergence of free, quality persistence layers like Hibernate. This is a very complex problem that often had to be manually done by hand (if you didn't want to dish out 4 figures for an O/R mapper that is).

    Floyd

  3. Humm... and standards?
    There is two standars to develop a O/R tools: ODMG and JDO.

    Ok, they are focused to Object Databases primary and based in bytecode enhancers or code generation stuff to implement them, but a very near approximation can be achieved using reflection or proxys (see ObjectBridge).

    Standars are like a God gift to open-source developers and to people working in new technologies: developers USE REALLY open-source technologies without afraid if they are standard based, because if fails people can use a commercial alternative.

    By example: JBoss, Apache, Tomcat, Xerces, Xalan, OpenORB Mozilla etc. are successful projects, because they run and are standards based.

    Long live to good standards.
  4. I think the only thing you need to do switching to/from JDO is (1) implement a different Java interface (2) to write new XML files. For one, we can create our own surrogate interface

    interface MyPersistency extends cirrus.hibernate.Persistent

    or

    interface MyPersistency extends javax.jdo.Persistent

    // for each class
    class MyRecord implements MyPersistency {...}

    So a simple recompile will work.

    Hope that Hibernate or somebody come up with a XLST to automate this as well.

    I have another question:

    How does Hibernate differ from Castor?
  5. Interesting. Opensource Castor ( http://castor.exolab.org ) is already doing the almost same thing, and we are using Castor in our project, which works pretty well with WebLogic and Oracle. Before jump into low level details, can not say which one is better.

    Besides JDO persistence, Castor also provides very good XML Data Binding feature, which gives us huge benefit. Seems Hibernate is also moving to that area according to its documents.
  6. Sadly Hibernate does not Oracle Sequence as ID generator yet.

    And a nice feature of Long Transaction in Castor is not supported in Hibernate. ( Long Transaction meaning you may load a JDO object in one tx, transfer it around, then update it back to database in another tx, which is very useful in web app )

  7. Re: standards.

    First of all, there are usually two main arguments for standards:

    1. different software needs to communicate at runtime (eg POSIX, CORBA, RMI)
    2. customers desire independence from (expensive, closed source, buggy) vendor middleware. (eg EJB, ODMG, JDO)

    Item 1 is not really relevant to persistence layers. Item 2 is _much_ more relevant to closed source solutions than it is to open source solutions. For example the communities based around Perl, Python, et al don't work by trying to produce complicated specifications a priori. In fact, they are quite happy to have just ONE implementation because _everyone_ can see the source, fix bugs, add missing features.

    It is my belief that some in the Java community have focused too much upon trying to come up with a priori standards, rather than letting things grow naturally. If, rather than rushing toward a standard, we let different competing solutions fight it out and then standardise upon a solution that takes the best from each, we might end up with better standards. I dont mean this as a diss to the people who are working very hard through the community process to come up with great Java standards. It is merely a caution against premature standardisation and a defense of experimantation outside the community process.

    The need for Hibernate is not that it will be a better solution than CMP or JDO for _everybody_, but that it will be a nicer solution for _some_ people. From the emails I've got in the last few days, apparently quite a few people DO prefer it.

    Secondly, we will hopefully inject new ideas into the Java community.

    It is my personal opinion (from which you are all free to disagree) that

    1. There is more than one way to skin a cat.
    2. Design by a committee of large vendors is rarely the best way to discover cat-skinning techniques.

    As a further observation, somewhat orthogonal to the subject of persistence layers, Java is not the first object-oriented, single-inheritence, cross-platform-bytecode, runtime-reflection-having language! We would do well to pay attention to experience and techniques used in SmallTalk as well as those used in C++.

    Re: other projects: Castor, ObjectRelationalBridge.

    Of course there are other open source tools! Fantastic! How could that possibly be a bad thing? Please note that neither of these projects actually implements JDO or ODMG at this stage (which is also not a bad thing - Castor actually improves on JDO). I wish the people working on these projects the very best of luck.

    What this means is that Java developers who are comfortable with open source tools will have more options. Notice that there are currently more options available in the commercial market for O/R mappers than there are in the open source community.

    One-size-fits-all solutions rarely fit anyone very _well_. Thats why there are ALREADY two Java O/R standards - CMP and JDO.

    Lets face it, JDO has a bad rap among many people ALREADY, before anybody is even using it (partly because it specifies an implementation, rather than an API) and ODMG is a famously failed standard. PLEASE dont flame me on this I am making an observation, not stating my own opinion of these standards.

    Re: Hibernate.

    Try it out :) Its still in beta but the reaction to it so far is VERY encouraging. Try writing a simple application using each of the mentioned tools, and perhaps even some commercial tools like CocoBase and see which one suits you best - for your particular cat.

    P.S. I live with four cats, so please no flames from cat-lovers.

    Peace

    1ovthafew
  8. How is this superior to object databases like db4o?

    That also uses reflection, and can persist any object ( deeply ). No need to implement Persistent either.



  9. "db4o community edition
    - free for non-commercial use"

    Hibernate is free software (LGPL).

    Hibernate is an object/relational tool suitable for use in enterprise environments.

    As far as I can tell, db4o is an embedded Java object database suitable for embedded applications.

    P.S. It is not very hard to implement the interface:

    public interface Persistent {}

    just like you implement java.io.Serializable for serialization.

    ;)
  10. I looked at Hibernate and it looks pretty cool. The only issue I have is its LGPL license, which, as far as I can tell from the LGPL licensing, means one can't use it with a product he intends to sell.

    Mark
  11. Mark you are thinking of the GPL. The L(esser)GPL is a less restrictive license specifically intended to allow linking of commercial products to open source libraries. IANAL but as far as I can tell the main thing it stops you doing is deriving a non-free _library_ from the free library. Certainly an LGPL library may be distributed with a commercial product that links to that library.

    Please be sceptical of claims made by Microsoft and others regarding open source licenses.
  12. I guess I am still confused. I attempted (again) to read through the LGPL. I know I can distritbuted it but what really can I do/not do?

    Can I ... create a product, that I intend to sell, that uses Hibernate , not modifying or adding to Hibernate in anyway, and not provide the source to my product? To use Hybernate, one has to 'link' to (Unlike tools like JBOSS, Apache Web Server, etc.).

    If someone really knows the answer it would be really great. Otherwise it is JDBC or some purchased tool(not that I mind - I just don't have a $1M).

    Thanks,
    Mark
  13. LGPL[ Go to top ]

    Yes, you are allowed to do that :)

    Quote: (from http://shelf.sourceforge.net/about/)
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    The LGPL is a software library license agreement that mandates policy on such issues as redistribution rights, when you must provide source code, and what you can and cannot charge for. In summary:

    - Source code of an LGPL library is freely redistributable.

    - LGPL Libraries are freely redistributable, and the source code for these libraries must be made available and is freely redistributable. If you modify the source code and rebuild the library, both the source and the library continue to be freely redistributable and the modified source must be made available.

    - Executables that link LGPL libraries can be distributed on any basis the creator wishes; HOWEVER, the source code for the LGPL libraries must continue to be available AND it must be possible for the recipient to modify the LGPL library and reconstruct the executable. Note this implies either the executable must dynamically link the LGPL library, or the source or object code must be available for the executable.

    - Source code, libraries, and executables covered by LGPL must be labelled as such, and appropriate copyright information must be displayed; see the text of the LGPL for the exact details.
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    This being a Java library, it is 99% likely to be dynamically linked.

    peace
  14. Can u scale an application built on top of hibernate from one server to multiple servers. Specifically, is concurrent modifications to the same database data from different servers supported?
  15. Yes - hibernate was designed from the ground up to support clustering.

    :)
  16. Hi dear friends

    I need to use Struts, SQL server and Hybernate together. Is there any tutorial/help on this. On urjent basis

    -Vladimir