play.db.jpa
类 JPA

java.lang.Object
  继承者 play.db.jpa.JPA

public class JPA
extends java.lang.Object

JPA Support This class holds reference to all JPA configurations. Each configuration has its own instance of JPAConfig. dbConfigName corresponds to properties-names in application.conf. The default DBConfig is the one configured using 'db.' in application.conf dbConfigName = 'other' is configured like this: db_other = mem db_other.user = batman This class also preserves backward compatibility by directing static methods to the default JPAConfig-instance A particular JPAConfig-instance uses the DBConfig with the same configName


构造方法摘要
JPA()
           
 
方法摘要
protected static void addConfiguration(java.lang.String configName, org.hibernate.ejb.Ejb3Configuration cfg)
           
protected static void clear()
           
protected static void clearJPAContext()
           
protected static void close()
           
static void closeTx(boolean rollback)
          clear current JPA context and transaction
static EntityManager em()
           
static int execute(java.lang.String query)
          Execute a JPQL query
static JPAConfig getJPAConfig(java.lang.String jpaConfigName)
           
static JPAConfig getJPAConfig(java.lang.String jpaConfigName, boolean ignoreError)
           
static boolean isEnabled()
           
static boolean isInsideTransaction()
           
static EntityManager newEntityManager()
           
static void setRollbackOnly()
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

JPA

public JPA()
方法详细信息

addConfiguration

protected static void addConfiguration(java.lang.String configName,
                                       org.hibernate.ejb.Ejb3Configuration cfg)

getJPAConfig

public static JPAConfig getJPAConfig(java.lang.String jpaConfigName)

getJPAConfig

public static JPAConfig getJPAConfig(java.lang.String jpaConfigName,
                                     boolean ignoreError)

close

protected static void close()

closeTx

public static void closeTx(boolean rollback)
clear current JPA context and transaction

参数:
rollback - shall current transaction be committed (false) or cancelled (true)

em

public static EntityManager em()

setRollbackOnly

public static void setRollbackOnly()

isEnabled

public static boolean isEnabled()
返回:
true if an entityManagerFactory has started

execute

public static int execute(java.lang.String query)
Execute a JPQL query


newEntityManager

public static EntityManager newEntityManager()

isInsideTransaction

public static boolean isInsideTransaction()
返回:
true if current thread is running inside a transaction

clear

protected static void clear()

clearJPAContext

protected static void clearJPAContext()


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly