當前位置: 首頁>>代碼示例>>Java>>正文


Java PersistenceContextType類代碼示例

本文整理匯總了Java中javax.persistence.PersistenceContextType的典型用法代碼示例。如果您正苦於以下問題:Java PersistenceContextType類的具體用法?Java PersistenceContextType怎麽用?Java PersistenceContextType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PersistenceContextType類屬於javax.persistence包,在下文中一共展示了PersistenceContextType類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getResourceToInject

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
/**
 * Resolve the object against the application context.
 */
@Override
protected Object getResourceToInject(Object target, String requestingBeanName) {
	// Resolves to EntityManagerFactory or EntityManager.
	if (this.type != null) {
		return (this.type == PersistenceContextType.EXTENDED ?
				resolveExtendedEntityManager(target, requestingBeanName) :
				resolveEntityManager(requestingBeanName));
	}
	else {
		// OK, so we need an EntityManagerFactory...
		return resolveEntityManagerFactory(requestingBeanName);
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:PersistenceAnnotationBeanPostProcessor.java

示例2: createEntityManager

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
public EntityManager createEntityManager(Map map) {
	//TODO support discardOnClose, persistencecontexttype?, interceptor,
	return new EntityManagerImpl(
			this, PersistenceContextType.EXTENDED, transactionType,
			discardOnClose, sessionInterceptorClass, map
	);
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:8,代碼來源:EntityManagerFactoryImpl.java

示例3: setEntityManager

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
@PersistenceContext(type = PersistenceContextType.EXTENDED)
public void setEntityManager(EntityManager em) {
	if (this.em != null) {
		throw new IllegalStateException("Already called");
	}
	this.em = em;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:8,代碼來源:PersistenceInjectionTests.java

示例4: getEntityManager

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
private EntityManager getEntityManager(final ExecutionContext context, final EntityManagerFactory emf) {
    EntityManager em = null;
    if (getPersistenceContextType(context) == PersistenceContextType.EXTENDED) {
        // EntityManager may be already open. If so use it.
        em = (EntityManager) context.getData(Constants.KEY_ENTITY_MANAGER);
    }

    if (em == null) {
        // create EntityManager and inject it
        em = emf.createEntityManager();
    }
    return em;
}
 
開發者ID:dadrus,項目名稱:jpa-unit,代碼行數:14,代碼來源:PersistenceContextDecorator.java

示例5: afterTest

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
@Override
public void afterTest(final TestInvocation invocation) throws Exception {
    final ExecutionContext context = invocation.getContext();

    final EntityManager em = (EntityManager) context.getData(Constants.KEY_ENTITY_MANAGER);
    if (em != null && getPersistenceContextType(context) != PersistenceContextType.EXTENDED) {
        context.storeData(Constants.KEY_ENTITY_MANAGER, null);
        em.close();
    }
}
 
開發者ID:dadrus,項目名稱:jpa-unit,代碼行數:11,代碼來源:PersistenceContextDecorator.java

示例6: sessionFactory

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
@Bean @PersistenceContext(type = PersistenceContextType.EXTENDED)
public SessionFactory sessionFactory() {
    LocalSessionFactoryBuilder builder = new LocalSessionFactoryBuilder(dataSource());
    builder.scanPackages("org.proflr.server.entity").addProperties(getHibernateProperties());

    return builder.buildSessionFactory();
}
 
開發者ID:proflr,項目名稱:proflr-server,代碼行數:8,代碼來源:Application.java

示例7: persistenceContext

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
private InjectionPoint persistenceContext(String unitName) {
    final InjectionPoint ip = mock(InjectionPoint.class);
    final Annotated annotated = mock(Annotated.class);
    when(ip.getAnnotated()).thenReturn(annotated);
    final PersistenceContext annotation = new PersistenceContext() {
        @Override
        public Class<? extends Annotation> annotationType() {
            return null;
        }

        @Override
        public String name() {
            return null;
        }

        @Override
        public String unitName() {
            return unitName;
        }

        @Override
        public PersistenceContextType type() {
            return null;
        }

        @Override
        public SynchronizationType synchronization() {
            return null;
        }

        @Override
        public PersistenceProperty[] properties() {
            return new PersistenceProperty[0];
        }
    };
    when(annotated.getAnnotation(PersistenceContext.class)).thenReturn(annotation);
    return ip;
}
 
開發者ID:dajudge,項目名稱:testee.fi,代碼行數:39,代碼來源:JpaInjectionServicesTest.java

示例8: getPersistenceContextType

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
private PersistenceContextType getPersistenceContextType(final ExecutionContext context) {
    final Field field = context.getPersistenceField();
    final PersistenceContext pc = field.getAnnotation(PersistenceContext.class);
    return pc.type();
}
 
開發者ID:dadrus,項目名稱:jpa-unit,代碼行數:6,代碼來源:PersistenceContextDecorator.java

示例9: type

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
@Override
public PersistenceContextType type()
{
    return PersistenceContextType.TRANSACTION;
}
 
開發者ID:satago,項目名稱:tapestry-jpa-transactions,代碼行數:6,代碼來源:PersistenceContextImpl.java

示例10: EntityManagerImpl

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
public EntityManagerImpl(EntityManagerFactoryImpl entityManagerFactory, PersistenceContextType pcType, SynchronizationType synchronizationType, PersistenceUnitTransactionType transactionType, boolean discardOnClose, Class sessionInterceptorClass, Map properties) {
    super(entityManagerFactory, pcType, synchronizationType, transactionType, discardOnClose, sessionInterceptorClass, properties);
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:4,代碼來源:EntityManagerImpl.java

示例11: method

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
@PersistenceContext(name = "method", unitName = "mu", type = PersistenceContextType.EXTENDED, properties = {
    @PersistenceProperty(name = "method1", value = "m1"),
    @PersistenceProperty(name = "method2", value = "m2")
})
public void method() {
}
 
開發者ID:apache,項目名稱:tomee,代碼行數:7,代碼來源:PersistenceContextAnnFactoryTest.java

示例12: setMyMethod

import javax.persistence.PersistenceContextType; //導入依賴的package包/類
@PersistenceContext(unitName = "mymu", type = PersistenceContextType.EXTENDED, properties = {
    @PersistenceProperty(name = "myMethod1", value = "mym1"),
    @PersistenceProperty(name = "myMethod2", value = "mym2")
})
public void setMyMethod() {
}
 
開發者ID:apache,項目名稱:tomee,代碼行數:7,代碼來源:PersistenceContextAnnFactoryTest.java


注:本文中的javax.persistence.PersistenceContextType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。