Difference between revisions of "Hibernate"

From BC$ MobileTV Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 135: Line 135:
 
* Hibernate 6 & JPQL Window Functions: https://vladmihalcea.com/hibernate-jpql-window-functions/
 
* Hibernate 6 & JPQL Window Functions: https://vladmihalcea.com/hibernate-jpql-window-functions/
 
* How to configure List semantics in Hibernate 6: https://thorben-janssen.com/hibernate-list-semantics/
 
* How to configure List semantics in Hibernate 6: https://thorben-janssen.com/hibernate-list-semantics/
 +
* Use Hibernate as a JPA Provider within Payara: https://blog.payara.fish/use-hibernate-as-a-jpa-provider-with-payara
  
  

Latest revision as of 09:53, 27 June 2022

Hibernate's goal is to relieve the developer from 95 percent of common data persistence related programming tasks, compared to manual coding with SQL and the JDBC API.

Hibernate Core for Java generates SQL for you, relieves you from manual JDBC result set handling and object conversion, and keeps your application portable to all SQL databases.[1].

NHibernate

Hibernate is also available in a .net variation called NHibernate: http://community.jboss.org/wiki/NHibernateforNET


Library

Hibernate ORM overview

Configuration

The Configuration can of Hibernate Object to Table mapping could be achieve by either of:

  1. XML file by the default name of "hibernate.cfg.xml" or some other name (through customized configuration settings) that can be passed in by default location (root of src folder), by file path, remote URL or as a Hibernate configuration object (pre-defined/loaded)
  2. Annotations such as @Entity and @Table that enable


SessionFactory

Provides context to the session (pulls in configuration details to enable access to DB). Typically single SessionFactory per application (and lasts for full application lifecycle).

Session

Acts as the persistence manager (central controller) that allows you to retrieve Objects to get data from the Hibernate cache. Any Transaction starts at the Session.


Transaction

The Transaction is a single operation (such as Create=INSERT, Read=SELECT, UPDATE, DELETE) carried out within a given Session.

Entity

Entities can be associated with one Session (attached), and are implicitly attached to the Session from which they were obtained (explicitly attached when saving for the first time or after using an attach method; implicitly detached after Session closed). [2]


OGM

Hibernate Object/Grid Mapper (OGM) provides Java Persistence (JPA) support for NoSQL solutions. It reuses Hibernate ORM’s engine but persists entities into a NoSQL datastore instead of a Relational Database. Hibernate OGM's project page boasts: "Many NoSQL stores, one standard way to access them" and support for a "wide range of backends" via store-specific dialects. Currently, there is production-grade support for

  1. Key/Value: Infinispan, Ehcache
  2. Document: MongoDB
  3. Graph: Neo4j




Tools


Resources


Tutorials


External Links


References

  1. Hibernate project home: https://www.hibernate.org/
  2. Difference between Entity in JPA and Hibernate: http://stackoverflow.com/questions/955515/difference-between-jpa-entity-and-hibernate-entity
  3. Hibernate 3 <generator> element: http:///www.roseindia.net/hibernate/hibernateidgeneratorelement.shtml

See Also

Database | SQL | RDBMS | ORM | Java/JPA | ASP.NET/LINQ | PHP/PDO