ORM

Category: /knowledge /development
Tags: 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>

评论

提示

  • 如果看不到评论部分, 请暂时关掉adblock in Firefox/Chrome
  • 本网站使用Javascript实现评论功能, 此处外链对提高您的网站PR没有帮助. (潜台词: 请不要灌水, 谢谢)