Package org.apache.openejb.jee.jpa.unit

Examples of org.apache.openejb.jee.jpa.unit.Persistence


       
        PersistenceUnit persistenceUnit = new PersistenceUnit("orange-unit");

        ClassLoader cl = this.getClass().getClassLoader();
        AppModule app = new AppModule(cl, "orange-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(persistenceUnit)));
        WebApp webApp = new WebApp();
        webApp.setMetadataComplete(true);
        app.getWebModules().add(new WebModule(webApp, "orange-web", cl, "war", "orange-id"));

        // Create app
View Full Code Here


       
        PersistenceUnit persistenceUnit = new PersistenceUnit("orange-unit");

        ClassLoader cl = this.getClass().getClassLoader();
        AppModule app = new AppModule(cl, "orange-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(persistenceUnit)));
        WebApp webApp = new WebApp();
        webApp.setMetadataComplete(true);
        app.getWebModules().add(new WebModule(webApp, "orange-web", cl, "war", "orange-id"));

        // Create app
View Full Code Here

       
        PersistenceUnit persistenceUnit = new PersistenceUnit("orange-unit");

        ClassLoader cl = this.getClass().getClassLoader();
        AppModule app = new AppModule(cl, "orange-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(persistenceUnit)));
        WebApp webApp = new WebApp();
        webApp.setMetadataComplete(true);
        app.getWebModules().add(new WebModule(webApp, "orange-web", cl, "war", "orange-web"));

        // Create app
View Full Code Here

       
        PersistenceUnit persistenceUnit = new PersistenceUnit("orange-unit");

        ClassLoader cl = this.getClass().getClassLoader();
        AppModule app = new AppModule(cl, "orange-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(persistenceUnit)));
        WebApp webApp = new WebApp();
        webApp.setMetadataComplete(true);
        app.getWebModules().add(new WebModule(webApp, "orange-web", cl, "war", "orange-web"));

        // Create app
View Full Code Here

       
        PersistenceUnit persistenceUnit = new PersistenceUnit("orange-unit");

        ClassLoader cl = this.getClass().getClassLoader();
        AppModule app = new AppModule(cl, "orange-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(persistenceUnit)));
        WebApp webApp = new WebApp();
        webApp.setMetadataComplete(true);
        app.getWebModules().add(new WebModule(webApp, "orange-web", cl, "war", "orange-web"));

        // Create app
View Full Code Here

        PersistenceUnit unit = new PersistenceUnit(unitName);
        unit.setJtaDataSource(jtaDataSource);
        unit.setNonJtaDataSource(nonJtaDataSource);

        AppModule app = new AppModule(this.getClass().getClassLoader(), unitName + "-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));

        // Create app

        AppInfo appInfo = config.configureApplication(app);
        assembler.createApplication(appInfo);
View Full Code Here

        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));

        AppModule app = new AppModule(this.getClass().getClassLoader(), "test-app");

        Persistence persistence = new Persistence(new org.apache.openejb.jee.jpa.unit.PersistenceUnit("foo-unit"));
        app.getPersistenceModules().add(new PersistenceModule("root", persistence));

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));
        app.getEjbModules().add(new EjbModule(ejbJar));
View Full Code Here

    private void deploy(AppModule app, PersistenceModule persistenceModule) throws OpenEJBException {
        if (!autoCreateResources) {
            return;
        }

        Persistence persistence = persistenceModule.getPersistence();
        for (PersistenceUnit unit : persistence.getPersistenceUnit()) {
            if (unit.getProvider() != null){
                logger.info("Configuring PersistenceUnit(name="+unit.getName()+", provider="+unit.getProvider()+")");
            } else {
                logger.info("Configuring PersistenceUnit(name="+unit.getName()+")");
            }
View Full Code Here

                persistenceUnit.setJtaDataSource(defaultCmpJTADataSource);
            }
            persistenceUnit.setNonJtaDataSource(defaultCmpNonJTADataSource);
            persistenceUnit.setExcludeUnlistedClasses(true);

            Persistence persistence = new Persistence();
            persistence.setVersion("2.0");
            persistence.getPersistenceUnit().add(persistenceUnit);

            geronimoEjbJarType.getPersistence().add(persistence);
        }
        persistenceUnit.getMappingFile().add("META-INF/openejb-cmp-generated-orm.xml");
    }
View Full Code Here

    }

    private void buildPersistenceModules(AppModule appModule, AppInfo appInfo) {
        for (PersistenceModule persistenceModule : appModule.getPersistenceModules()) {
            String rootUrl = persistenceModule.getRootUrl();
            Persistence persistence = persistenceModule.getPersistence();
            for (PersistenceUnit persistenceUnit : persistence.getPersistenceUnit()) {
                PersistenceUnitInfo info = new PersistenceUnitInfo();
                info.id = persistenceUnit.getName() + " " + rootUrl.hashCode();
                info.name = persistenceUnit.getName();
                info.watchedResources.addAll(persistenceModule.getWatchedResources());
                info.persistenceUnitRootUrl = rootUrl;
View Full Code Here

TOP

Related Classes of org.apache.openejb.jee.jpa.unit.Persistence

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.