Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Hibernate (framework)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Persistence== Hibernate provides transparent persistence for [[Plain Old Java Object]]s (POJOs).{{sfn|Bauer|King|Gregory|2015}}{{rp|Β§=3.2.2|pp=37β38}} The only strict requirement for a persistent class is a [[Nullary constructor|no-argument constructor]],{{sfn|Bauer|King|Gregory|2015}}{{rp|Β§=3.2.3|pp=39}} though not necessarily '''{{code|public}}'''. Proper behavior in some applications also requires special attention to the {{Javadoc|module=java.base|package=java.lang|class=Object|member=equals(java.lang.Object)|text=equals(Object obj)|monotype=y}} and {{Javadoc|module=java.base|package=java.lang|class=Object|member=hashCode()|text=hashCode()|monotype=y}} methods in the {{code|Object}} classes.<ref>{{cite web|title=Equals and HashCode|url=https://community.jboss.org/wiki/EqualsAndHashCode|publisher=JBoss Community|access-date=2013-12-16|archive-date=2013-12-16|archive-url=https://web.archive.org/web/20131216104403/https://community.jboss.org/wiki/EqualsAndHashCode|url-status=dead}}</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 {{Javadoc|module=java.base|package=java.util|class=Set|text=Set|monotype=y}} and {{Javadoc|module=java.base|package=java.util|class=List|text=List|monotype=y}} interfaces. [[Generics in Java|Java generics]], introduced in Java 5, are also supported. Hibernate can be configured to [[lazy load]] associated collections.{{sfn|Bauer|King|Gregory|2015}}{{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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)