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
从类 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