ORM
Category: /knowledge /developmentTags: development hibernate
Concepts
What’s persistence
Persistence simply means that we would like our application’s data to outlive the applications process. In Java terms, we would like the state of (some of) our objects to live beyond the scope of the JVM so that the same state is available later.
Hibernate
Basic workflow:
- load configuration
- create a session factory
- use factory to create a new session instance
- session instance performs some work
- close session instance
Configuration sample: hibernate.cfg.xml
<hibernate-configuration>
<session-factory>
<property name="connection.provider_class">
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.NoCacheProvider</property>
<property name="dialect">
org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">false</property>
<!-- Mapping files -->
<mapping resource="plan.hbm.xml"></mapping>