本文整理了Java中org.hibernate.ejb.HibernateEntityManager
类的一些代码示例,展示了HibernateEntityManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HibernateEntityManager
类的具体详情如下:
包路径:org.hibernate.ejb.HibernateEntityManager
类名称:HibernateEntityManager
HibernateEntityManager介绍
暂无
代码示例
代码示例来源:origin: stackoverflow.com
HibernateEntityManager hem = em.unwrap(HibernateEntityManager.class);
Session session = hem.getSession();
代码示例来源:origin: org.compass-project/compass
wrapper.open();
HibernateEntityManager entityManager = (HibernateEntityManager) wrapper.getEntityManager();
entityManager.getSession().setCacheMode(CacheMode.IGNORE);
if (log.isDebugEnabled()) {
log.debug(jpaGpsDevice.buildMessage("Indexing entities [" + entityInformation.getName() + "] using query ["
Boolean performOrder = performOrderByPerEntity.get(entityInformation.getName());
if (performOrder == null || performOrder) {
ClassMetadata metadata = entityManager.getSession().getSessionFactory().getClassMetadata(entityInformation.getName());
String idPropName = metadata.getIdentifierPropertyName();
if (idPropName != null) {
RowBuffer buffer = new RowBuffer(session, entityManager.getSession(), fetchCount);
Object prev = null;
while (true) {
cursor.close();
entityManager.clear();
wrapper.close();
} catch (Exception e) {
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public Criteria createCriteria(Class> entityClass) {
return ((HibernateEntityManager) getStandardEntityManager()).getSession().createCriteria(entityClass);
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public SessionFactory getSessionFactory(HibernateEntityManager entityManager) {
return entityManager.getSession().getSessionFactory();
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
private static void activateSession() {
Map resourceMap = TransactionSynchronizationManager.getResourceMap();
for (Map.Entry entry : resourceMap.entrySet()) {
if (entry.getKey() instanceof EntityManagerFactory && entry.getValue() instanceof EntityManagerHolder) {
((HibernateEntityManager) ((EntityManagerHolder) entry.getValue()).getEntityManager()).getSession();
}
}
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public Blob createBlob(InputStream uploadedFileInputStream, long fileSize) throws IOException {
InputStream inputStream = uploadedFileInputStream;
//We'll work with Blob instances and streams so that the uploaded files are never read into memory
return ((HibernateEntityManager) em).getSession().getLobHelper().createBlob(inputStream, fileSize);
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public List readOffersByAutomaticDeliveryType() {
//TODO change this to a JPA criteria
Criteria criteria = ((HibernateEntityManager) em).getSession().createCriteria(OfferImpl.class);
Date myDate = getCurrentDateAfterFactoringInDateResolution();
Calendar c = Calendar.getInstance();
c.setTime(myDate);
c.add(Calendar.DATE, +1);
criteria.add(Restrictions.lt("startDate", c.getTime()));
c = Calendar.getInstance();
c.setTime(myDate);
c.add(Calendar.DATE, -1);
criteria.add(Restrictions.or(Restrictions.isNull("endDate"), Restrictions.gt("endDate", c.getTime())));
criteria.add(Restrictions.or(Restrictions.eq("archiveStatus.archived", 'N'),
Restrictions.isNull("archiveStatus.archived")));
criteria.add(Restrictions.eq("automaticallyAdded", true));
criteria.setCacheable(true);
criteria.setCacheRegion("query.Offer");
return criteria.list();
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public Map getIdMetadata(Class> entityClass, HibernateEntityManager entityManager) {
entityClass = getNonProxyImplementationClassIfNecessary(entityClass);
Map respOnse= new HashMap<>();
SessionFactory sessiOnFactory= entityManager.getSession().getSessionFactory();
ClassMetadata metadata = sessionFactory.getClassMetadata(entityClass);
if (metadata == null) {
return null;
}
String idProperty = metadata.getIdentifierPropertyName();
response.put("name", idProperty);
Type idType = metadata.getIdentifierType();
response.put("type", idType);
return response;
}
代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model
/**
*
* @return
*/
public Session getSession() {
return ( (HibernateEntityManager) entityManager ).getSession();
}
代码示例来源:origin: stackoverflow.com
public org.hibernate.Criteria getCriteria() {
HibernateEntityManager hem = em.unwrap(HibernateEntityManager.class);
org.hibernate.Session session = hem.getSession();
if(session.isOpen())
{
return session.createCriteria(getEntityBeanType())
}
return null;
}
代码示例来源:origin: se.vgregion.webbisar/webbisar-core-bc-composite-svc
private Session getHibernateSession(EntityManager em) {
return ((HibernateEntityManager) em).getSession();
}
代码示例来源:origin: stackoverflow.com
HibernateEntityManager em = (HibernateEntityManager) emf.createEntityManager();
DbUnitDataLoader loader = new DbUnitDataLoader(testData, em.getSession().connection());
代码示例来源:origin: stackoverflow.com
@Transient
public static Collection> searchResults(JsonJqgridSearchModel jsonJqgridSearchModel){
HibernateEntityManager hem = Person.entityManager().unwrap(HibernateEntityManager.class);
Session session = hem.getSession();
Criteria criteria = session.createCriteria(Person.class);
Iterator iterator = jsonJqgridSearchModel.rules.iterator();
while(iterator.hasNext()){
criteria.add(iterator.next().getRestriction());
}
return criteria.list();
}
代码示例来源:origin: stackoverflow.com
/**
*
* @param objects
*/
public static void deleteAll(List> objects) {
try {
HibernateEntityManager em = JPA.em().unwrap(HibernateEntityManager.class);
Session session = em.getSession();
for (Object o : objects) {
session.delete(o);
}
} catch (Exception e) {
Logger.error("CommonHibernateBD_deleteAll error: " + e);
e.printStackTrace();
}
}
代码示例来源:origin: stackoverflow.com
public Connection getConnection(final EntityManager em) {
HibernateEntityManager hem = (HibernateEntityManager) em;
SessionImplementor sim = (SessionImplementor) hem.getSession();
return sim.connection();
}
代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core
public Session getHibernateSession()
{
EntityManager persistenceCOntext= getPersistenceContext();
if (persistenceContext instanceof HibernateEntityManager )
{
return ((HibernateEntityManager) persistenceContext).getSession();
}
throw new RuntimeException("ILLEGAL ACTION: Not a Hibernate persistence provider");
}
代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-persistence-impl
/***************************************************************************
*
*
**************************************************************************/
protected Connection getJdbcConnection (final EntityManager em)
{
return ((HibernateEntityManager)em).getSession().connection();
}
代码示例来源:origin: stackoverflow.com
private Connection getConnection(final EntityManager em) {
HibernateEntityManager hem = (HibernateEntityManager) em;
SessionImplementor sim = (SessionImplementor) hem.getSession();
return sim.connection();
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core
public Session getSession() {
Session session = ((HibernateEntityManager)getEntityManager()).getSession();
return session;
}
代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly
public Session getSession() {
Session session = ((HibernateEntityManager)getEntityManager()).getSession();
return session;
}