Example usage for javax.persistence.spi PersistenceUnitInfo getPersistenceUnitName

List of usage examples for javax.persistence.spi PersistenceUnitInfo getPersistenceUnitName

Introduction

In this page you can find the example usage for javax.persistence.spi PersistenceUnitInfo getPersistenceUnitName.

Prototype

public String getPersistenceUnitName();

Source Link

Document

Returns the name of the persistence unit.

Usage

From source file:com.impetus.kundera.KunderaPersistence.java

@Override
public final EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
    return createEntityManagerFactory(info.getPersistenceUnitName(), map);
}

From source file:com.impetus.kundera.ejb.EntityManagerFactoryImpl.java

/**
 * This one is generally called via the PersistenceProvider.
 * //from  w w w . j av a2  s  .  c  o m
 * @param persistenceUnitInfo
 *            only using persistenceUnitName for now
 * @param props
 *            the props
 */
public EntityManagerFactoryImpl(PersistenceUnitInfo persistenceUnitInfo, Map props) {
    this(persistenceUnitInfo != null ? persistenceUnitInfo.getPersistenceUnitName() : null, props);
}

From source file:org.batoo.jpa.core.BatooPersistenceProvider.java

/**
 * {@inheritDoc}// ww  w  . j a  v  a2s  . c  o  m
 * 
 */
@Override
@SuppressWarnings("rawtypes")
public EntityManagerFactoryImpl createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
    try {
        final PersistenceParser parser = new org.batoo.jpa.parser.PersistenceParserImpl(info, null);

        return StringUtils.isNotBlank(parser.getJtaDatasource()) ? //
                new org.batoo.jpa.core.impl.manager.JtaEntityManagerFactoryImpl(info.getPersistenceUnitName(),
                        parser)
                : new EntityManagerFactoryImpl(info.getPersistenceUnitName(), parser);
    } catch (final Throwable e) {
        if ((e instanceof PersistenceException) || (e instanceof MappingException)
                || (e instanceof BatooException)) {
            throw (RuntimeException) e;
        }

        BatooPersistenceProvider.LOG.info(e,
                "Unable to find Batoo JPA persistence unit: " + info.getPersistenceUnitName());

        return null;
    }
}