/** * One time initialization for persistence unit metadata. * * @param persistenceUnit * Persistence Unit/ Comma separated persistence units */ private void configurePersistenceUnit(String persistenceUnit, Map props) { // Invoke Persistence unit MetaData if (persistenceUnit == null) { throw new KunderaException("Persistence unit name should not be null"); } if (logger.isInfoEnabled()) { logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.", persistenceUnit); } String[] persistenceUnits = persistenceUnit.split(Constants.PERSISTENCE_UNIT_SEPARATOR); new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(); }
public void configure(PersistenceUnitInfo puInfo) { log.info("Loading Metadata from persistence.xml ..."); ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata(); Map<String, PersistenceUnitMetadata> metadatas = new HashMap<String, PersistenceUnitMetadata>(); this.configure(); for (String persistenceUnit : persistenceUnits) { mergeProperties(puInfo, appMetadata, persistenceUnit); } }
@Override public void configure() { log.info("Loading Metadata from persistence.xml ..."); ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata(); try { Map<String, PersistenceUnitMetadata> metadatas = findPersistenceMetadatas(); for (String persistenceUnit : persistenceUnits) { if (!metadatas.containsKey(persistenceUnit)) { log.error("Unconfigured persistence unit: " + persistenceUnit + " please validate with persistence.xml"); throw new PersistenceUnitConfigurationException("Invalid persistence unit: " + persistenceUnit + " provided"); } } log.info("Finishing persistence unit metadata configuration ..."); appMetadata.addPersistenceUnitMetadata(metadatas); } catch (InvalidConfigurationException icex) { log.error("Error occurred during persistence unit configuration, Caused by: .", icex); throw new PersistenceLoaderException(icex); } }
/** * One time initialization for persistence unit metadata. * * @param persistenceUnit * Persistence Unit/ Comma separated persistence units */ private void configurePersistenceUnit(PersistenceUnitInfo puInfo, Map props) { // Invoke Persistence unit MetaData if (puInfo.getPersistenceUnitName() == null) { throw new KunderaException("Persistence unit name should not be null"); } if (logger.isInfoEnabled()) { logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.", puInfo.getPersistenceUnitName()); } String[] persistenceUnits = puInfo.getPersistenceUnitName().split(Constants.PERSISTENCE_UNIT_SEPARATOR); new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(puInfo); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { emf = Persistence.createEntityManagerFactory(pu); new PersistenceUnitConfiguration(null, ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), pu) .configure(); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { EntityManagerFactoryImpl emfImpl = getEntityManagerFactory(); new PersistenceUnitConfiguration(null, emfImpl.getKunderaMetadataInstance(), "kunderatest").configure(); PersistenceCache persistenceCache = new PersistenceCache(); graphBuilder = new ObjectGraphBuilder(persistenceCache, new PersistenceDelegator( emfImpl.getKunderaMetadataInstance(), persistenceCache)); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { emfImpl = getEntityManagerFactory(); new PersistenceUnitConfiguration(null, emfImpl.getKunderaMetadataInstance(), "kunderatest").configure(); pc = new PersistenceCache(); graphBuilder = new ObjectGraphBuilder(pc, new PersistenceDelegator(emfImpl.getKunderaMetadataInstance(), pc)); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); emfImpl = getEntityManagerFactory(); graphBuilder = new ObjectGraphBuilder(pc, new PersistenceDelegator(emfImpl.getKunderaMetadataInstance(), pc)); // configurator.configure(); new PersistenceUnitConfiguration(null, emfImpl.getKunderaMetadataInstance(), "kunderatest").configure(); // new MetamodelConfiguration("kunderatest").configure(); }