zoukankan      html  css  js  c++  java
  • [Hibernate] official tutorial

    Persistence contexts

    org.hibernate.Session API and javax.persistence.EntityManager API represent a context for dealing with persistent data. This concept is called  apersistencec context. Persistent data has a state in relation to both a persistence context and the underlying database.

    transient瞬时

    The entity has just been instantiated and is not assocaiated with a persistence context.

    It has no persistent representation in the database and typically no identifier value has been assigned(unless the assigned generator was used).

    managed, or persistent 持久的]

    实体有一个关联的标识符,并且和持久化上下文关联.

    物理地存在或者不存在于数据库中.

    detached 托管的,游离的

    有关联的标识符,但是不再和持久化上下滑关联(通常因为持久化上下文被关闭或者实例被上下文清除.

    removed

    实体有关联的标识符并且和持久化上下文关联,然而它被计划从数据库中移除.

    大多数org.hibernate.Session API and javax.persistence.EntityManager API的方法处理实体在这些状态之间的变动.

    -------------从JPA中访问Hibernate APIs--------

    Session session = entityManager.unwrap( Session.class );
    SessionImplementor sessionImplementor = entityManager.unwrap( SessionImplementor.class );
    
    SessionFactory sessionFactory = entityManager.getEntityManagerFactory().unwrap( SessionFactory.class );
    ----------------

    宛如智障,暗藏锋芒
  • 相关阅读:
    2-Fourteenth Scrum Meeting-20151214
    2-Thirteenth Scrum Meeting-10151213
    2-Twelfth Scrum Meeting20151212
    2-Eleventh Scrum Meeting20151211
    L465 Climate Change May Take Away Your Ability to Flush the Toilet
    L458 Interview
    L457 早上锻炼减肥
    L456 学英语 看美剧
    L455 人之初,性本衰
    L454 正确喝水
  • 原文地址:https://www.cnblogs.com/zienzir/p/9176543.html
Copyright © 2011-2022 走看看