Examples of Persistence


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

        unit.setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.setProperty("openjpa.Log", "DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE");
        unit.setExcludeUnlistedClasses(true);

        final Persistence persistence = new Persistence(unit);
        persistence.setVersion("2.0");
        return persistence;
    }
View Full Code Here

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

                    setId(connector, method);
                    appModule.getConnectorModules().add(new ConnectorModule(connector));

                } else if (obj instanceof Persistence) {

                    final Persistence persistence = (Persistence) obj;
                    appModule.getPersistenceModules().add(new PersistenceModule("", persistence));

                } else if (obj instanceof PersistenceUnit) {

                    final PersistenceUnit unit = (PersistenceUnit) obj;
                    appModule.getPersistenceModules().add(new PersistenceModule("", new Persistence(unit)));

                } else if (obj instanceof Beans) {

                    final Beans beans = (Beans) obj;
                    final EjbModule ejbModule = new EjbModule(new EjbJar(method.getName()));
View Full Code Here

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

                        final Connector connector = (Connector) modules;
                        appModule.getConnectorModules().add(new ConnectorModule(connector));

                    } else if (modules instanceof Persistence) {

                        final Persistence persistence = (Persistence) modules;
                        appModule.getPersistenceModules().add(new PersistenceModule("", persistence));

                    } else if (modules instanceof PersistenceUnit) {

                        final PersistenceUnit unit = (PersistenceUnit) modules;
                        appModule.getPersistenceModules().add(new PersistenceModule("", new Persistence(unit)));

                    } else if (modules instanceof Beans) {

                        final Beans beans = (Beans) modules;
                        final EjbModule ejbModule = new EjbModule(new EjbJar());
View Full Code Here

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

    private void deploy(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

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

        URL resource = this.getClass().getClassLoader().getResource("persistence-example.xml");
        InputStream in = resource.openStream();
        java.lang.String expected = readContent(in);

        Persistence element =  (Persistence) unmarshaller.unmarshal(new ByteArrayInputStream(expected.getBytes()));
        unmarshaller.setEventHandler(new TestValidationEventHandler());
        System.out.println("unmarshalled");

        Marshaller marshaller = ctx.createMarshaller();
        marshaller.setProperty("jaxb.formatted.output", true);
View Full Code Here

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

            } else {
                persistenceUnit.setJtaDataSource("?name=SystemDatasource");
            }
            persistenceUnit.setNonJtaDataSource("?name=NoTxDatasource");

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

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

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

                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

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

                moduleName = moduleName.replaceFirst("/?META-INF/.*persistence.xml$", "/");
                if (moduleName.startsWith("jar:")) moduleName = moduleName.substring("jar:".length());
                if (moduleName.startsWith("file:")) moduleName = moduleName.substring("file:".length());
//                if (moduleName1.endsWith("/")) moduleName1 = moduleName1.substring(0, moduleName1.length() - 1);
                try {
                    Persistence persistence = JaxbPersistenceFactory.getPersistence(persistenceUrl);
                    PersistenceModule persistenceModule = new PersistenceModule(moduleName, persistence);
                    persistenceModule.getWatchedResources().add(moduleName);
                    if ("file".equals(persistenceUrl.getProtocol())) {
                        persistenceModule.getWatchedResources().add(toFilePath(persistenceUrl));
                    }
View Full Code Here

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

        PersistenceUnit unit2 = new PersistenceUnit("lime-unit");
        unit2.setJtaDataSource("Lime");
        unit2.setNonJtaDataSource("LimeUnmanaged");

        AppModule app = new AppModule(this.getClass().getClassLoader(), "test-app");
        app.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit1, unit2)));

        // Create app

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

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

        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
TOP
Copyright © 2018 www.massapi.com. 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.