EJB design: Difference/Similarity between ORM(say,Hibernate)& Value Objects

  1. Hello Friends,

    Iam new to ORM techniques.
    Would anybody tell me the differnce between ORM(say,Hibernate)& Value Objects (that includes DAOs etc).
    I find, they both are just Getter & Setter methods.Then what is the actual diffence and is there any other similarities functionaly.

    Which is more advantageous- ORM or VOs.

    Also, Iam told Hibernate and Strutts are not compatible?. Is this true?.

    Thanks in advance.

  2. Hi,

    The difference is that with hibernate you don't have to write the JDBC code on you own, so I strongly recommend it since JDBC is quite boring to write. (Maybe I say boring because I have written it in +10 projects?)

    I also want to comment the "only getter and setters" statement. I think you should thind on business objects and not value object. A business object also contains the logic associated with the entity. Normally, a business objects have more getters than setters. On the other hand, the business objects have methods for actions on the object, for example open(), checkOut(), and things like that. This means you tell the business object to do something with the object, you do not set the parameters directly.

    Example: If you have an Account, you should not be allowed to close it unless it is open. Trying to close an already closed account should result in an IllegalStateException. On the state of the accout, you should have a getter but no setter. The state is a result of other action and not something you just set.

    Unfortunately, I don't have any litterature recommendations. But maybe someone else have ideas?