本文整理汇总了Java中javax.persistence.EntityManager.getMetamodel方法的典型用法代码示例。如果您正苦于以下问题:Java EntityManager.getMetamodel方法的具体用法?Java EntityManager.getMetamodel怎么用?Java EntityManager.getMetamodel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.EntityManager
的用法示例。
在下文中一共展示了EntityManager.getMetamodel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromPersistenceUnit
import javax.persistence.EntityManager; //导入方法依赖的package包/类
public static JpaMetamodelRedGProvider fromPersistenceUnit(String perstistenceUnitName) {
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(perstistenceUnitName, properties);
EntityManager entityManager = entityManagerFactory.createEntityManager();
return new JpaMetamodelRedGProvider(entityManager.getMetamodel());
}
示例2: initEntityManager
import javax.persistence.EntityManager; //导入方法依赖的package包/类
private void initEntityManager(final EntityManagerFactory emf) {
EntityManager em = null;
try {
em = emf.createEntityManager();
em.getMetamodel();
} finally {
CloseUtils.closeQuietly(em);
}
}
示例3: BaseRepositoryImpl
import javax.persistence.EntityManager; //导入方法依赖的package包/类
public BaseRepositoryImpl(Class<T> entityClass, EntityManager entityManager) {
super(entityClass, entityManager);
this.entityClass = entityClass;
this.entityManager = entityManager;
entityInformation = new JpaMetamodelEntityInformation<T, ID>(entityClass, entityManager.getMetamodel());
}