Content deleted Content added
→Persistence: Add in-line citation |
→Persistence: Add in-line citation |
||
Line 46:
Hibernate provides transparent persistence for [[Plain Old Java Object]]s (POJOs).{{sfn|Bauer|2016}}{{rp|§=3.2.2|pp=37-38}} The only strict requirement for a persistent class is a [[Nullary constructor|no-argument constructor]]{{sfn|Bauer|2016}}{{rp|§=3.2.3|pp=39}}, though not necessarily {{code|public}}. Proper behavior in some applications also requires special attention to the {{code|equals()}} and {{code|hashCode()}} methods in the object classes.<ref>{{cite web|title=Equals and HashCode|url=https://community.jboss.org/wiki/EqualsAndHashCode|publisher=JBoss Community}}</ref> Hibernate recommends providing an identifier attribute, and this is planned to be a mandatory requirement in a future release.<ref>{{cite web|title=Hibernate User Guide: 2.5.5. Provide identifier attribute|url=http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#entity-pojo-identifier|publisher=JBoss Community}}</ref>
Collections of data objects are typically stored in Java collection classes, such as implementations of the {{code|Set}} and {{code|List}} interfaces. [[Generics in Java|Java generics]], introduced in Java 5, are also supported. Hibernate can be configured to [[lazy load]] associated collections.{{sfn|Bauer|2016}}{{rp|§=12.1|pp=289-293}} Lazy loading is the default as of Hibernate 3.
Related objects can be configured to ''[[Propagation constraint|cascade]]'' operations from one object to the other. For example, a parent {{code|Album}} class object can be configured to cascade its {{code|save}} and {{code|delete}} operations to its child {{code|Track}} class objects.
|