Package org.springframework.orm.jpa

Examples of org.springframework.orm.jpa.EntityManagerFactoryInfo


    if (emf == null) {
      throw new IllegalArgumentException("entityManagerFactory is required");
    }
    Class[] ifcs = null;
    if (emf instanceof EntityManagerFactoryInfo) {
      EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf;
      if (this.entityManagerInterface == null) {
        this.entityManagerInterface = emfInfo.getEntityManagerInterface();
        if (this.entityManagerInterface == null) {
          this.entityManagerInterface = EntityManager.class;
        }
      }
      JpaDialect jpaDialect = emfInfo.getJpaDialect();
      if (jpaDialect != null && jpaDialect.supportsEntityManagerPlusOperations()) {
        ifcs = new Class[] {this.entityManagerInterface, EntityManagerPlus.class};
      }
      else {
        ifcs = new Class[] {this.entityManagerInterface};
View Full Code Here


    return HIBERNATE_CONFIG_LOCATIONS;
  }


  public void testCanCastNativeEntityManagerFactoryToHibernateEntityManagerFactoryImpl() {
    EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
    assertTrue(emfi.getNativeEntityManagerFactory() instanceof HibernateEntityManagerFactory);
  }
View Full Code Here

    return ECLIPSELINK_CONFIG_LOCATIONS;
  }


  public void testCanCastNativeEntityManagerFactoryToTopLinkEntityManagerFactoryImpl() {
    EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
    assertTrue(emfi.getNativeEntityManagerFactory().getClass().getName().endsWith("EntityManagerFactoryImpl"));
  }
View Full Code Here

    return TOPLINK_CONFIG_LOCATIONS;
  }


  public void testCanCastNativeEntityManagerFactoryToTopLinkEntityManagerFactoryImpl() {
    EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
    assertTrue(emfi.getNativeEntityManagerFactory().getClass().getName().endsWith("EntityManagerFactoryImpl"));
  }
View Full Code Here

  protected String[] getConfigLocations() {
    return OPENJPA_CONFIG_LOCATIONS;
  }

  public void testCanCastNativeEntityManagerFactoryToOpenJpaEntityManagerFactoryImpl() {
    EntityManagerFactoryInfo emfi = (EntityManagerFactoryInfo) entityManagerFactory;
    assertTrue("native EMF expected", emfi.getNativeEntityManagerFactory() instanceof OpenJPAEntityManagerFactory);
  }
View Full Code Here

    if (emf == null) {
      throw new IllegalArgumentException("'entityManagerFactory' or 'persistenceUnitName' is required");
    }
    Class[] ifcs = null;
    if (emf instanceof EntityManagerFactoryInfo) {
      EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf;
      if (this.entityManagerInterface == null) {
        this.entityManagerInterface = emfInfo.getEntityManagerInterface();
        if (this.entityManagerInterface == null) {
          this.entityManagerInterface = EntityManager.class;
        }
      }
      JpaDialect jpaDialect = emfInfo.getJpaDialect();
      if (jpaDialect != null && jpaDialect.supportsEntityManagerPlusOperations()) {
        ifcs = new Class[] {this.entityManagerInterface, EntityManagerPlus.class};
      }
      else {
        ifcs = new Class[] {this.entityManagerInterface};
View Full Code Here

    if (emf == null) {
      throw new IllegalArgumentException("entityManagerFactory is required");
    }
    Class[] ifcs = null;
    if (emf instanceof EntityManagerFactoryInfo) {
      EntityManagerFactoryInfo emfInfo = (EntityManagerFactoryInfo) emf;
      if (this.entityManagerInterface == null) {
        this.entityManagerInterface = emfInfo.getEntityManagerInterface();
      }
      JpaDialect jpaDialect = emfInfo.getJpaDialect();
      if (jpaDialect != null && jpaDialect.supportsEntityManagerPlusOperations()) {
        ifcs = new Class[] {this.entityManagerInterface, EntityManagerPlus.class};
      }
      else {
        ifcs = new Class[] {this.entityManagerInterface};
View Full Code Here

    public static PersistenceUnitInfo getPUInfoFromAppContext(ApplicationContext ctx) {
        Map<String, EntityManagerFactoryInfo> map = ctx.getBeansOfType(EntityManagerFactoryInfo.class);
        if (map == null || map.isEmpty()) {
            return null;
        }
        EntityManagerFactoryInfo emfi = map.get(map.keySet().iterator().next()); // injected EMF
        return emfi.getPersistenceUnitInfo();
    }
View Full Code Here

    public static String getPersistenceUnitName(ApplicationContext ctx) {
        Map<String, EntityManagerFactoryInfo> map = ctx.getBeansOfType(EntityManagerFactoryInfo.class);
        if (map.isEmpty()) {
            throw new RuntimeException("Could not retrieve persistence unit name. No suitable EntityManagerFactory was found.");
        }
        EntityManagerFactoryInfo emf = map.get(map.keySet().iterator().next()); // injected EMF

        return emf.getPersistenceUnitName();
    }
View Full Code Here

    private static final Logger log = LoggerFactory.getLogger(HibernateUtils.class);

    private static ApplicationContext ctx = null;

    public static Statistics getStatistics() {
        EntityManagerFactoryInfo entityManagerFactoryInfo = (EntityManagerFactoryInfo) ctx.getBean("entityManagerFactory");
        EntityManagerFactory emf = entityManagerFactoryInfo.getNativeEntityManagerFactory();
        EntityManagerFactoryImpl emfImp = (EntityManagerFactoryImpl) emf;
        return emfImp.getSessionFactory().getStatistics();
    }
View Full Code Here

TOP

Related Classes of org.springframework.orm.jpa.EntityManagerFactoryInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.