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

Examples of org.apache.openejb.jee.jpa.unit.PersistenceUnit.addClass()


        return bean;
    }

    @Module public Persistence persistence() {
        final PersistenceUnit unit = new PersistenceUnit("ImportSqlScriptTest");
        unit.addClass(Something.class);
        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);
View Full Code Here


        return bean;
    }

    @Module public Persistence persistence() {
        PersistenceUnit unit = new PersistenceUnit("foo-unit");
        unit.addClass(EntityToValidate.class);
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
        unit.setExcludeUnlistedClasses(true);

        Persistence persistence = new Persistence(unit);
View Full Code Here

        AppModule appModule = new AppModule(ejbModule.getClassLoader(), "test-dynamic-data-source");
        appModule.getEjbModules().add(ejbModule);

        // Create a persistence-units
        PersistenceUnit unit = new PersistenceUnit("router");
        unit.addClass(Person.class);
        unit.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema");
        unit.setTransactionType(TransactionType.JTA);
        unit.setJtaDataSource("Routed Datasource");
        appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));
        for (int i = 1; i <= 3; i++) {
View Full Code Here

        unit.setTransactionType(TransactionType.JTA);
        unit.setJtaDataSource("Routed Datasource");
        appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));
        for (int i = 1; i <= 3; i++) {
            PersistenceUnit u = new PersistenceUnit("db" + i);
            u.addClass(Person.class);
            u.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema");
            u.setTransactionType(TransactionType.JTA);
            u.setJtaDataSource("database" + i);
            appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(u)));
        }
View Full Code Here

        // Add the ejb-jar.xml to the ear
        appModule.getEjbModules().add(ejbModule);

        // Create a persistence-unit for this app
        PersistenceUnit unit = new PersistenceUnit("testUnit");
        unit.addClass(Color.class);
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");

        // Add the persistence.xml to the "ear"
        appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));
View Full Code Here

        return ejbJar;
    }

    @Module public Persistence persistence() {
        PersistenceUnit unit = new PersistenceUnit("pu");
        unit.addClass(User.class);
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.setExcludeUnlistedClasses(true);

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

        return ejbJar;
    }

    @Module public Persistence persistence() {
        PersistenceUnit unit = new PersistenceUnit("pu");
        unit.addClass(User.class);
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.setExcludeUnlistedClasses(true);

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

        AppModule appModule = new AppModule(ejbModule.getClassLoader(), "test-dynamic-data-source");
        appModule.getEjbModules().add(ejbModule);

        // Create a persistence-units
        PersistenceUnit unit = new PersistenceUnit("router");
        unit.addClass(Person.class);
        unit.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema");
        unit.setTransactionType(TransactionType.JTA);
        unit.setJtaDataSource("Routed Datasource");
        appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));
        for (int i = 1; i <= 3; i++) {
View Full Code Here

        unit.setTransactionType(TransactionType.JTA);
        unit.setJtaDataSource("Routed Datasource");
        appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(unit)));
        for (int i = 1; i <= 3; i++) {
            PersistenceUnit u = new PersistenceUnit("db" + i);
            u.addClass(Person.class);
            u.getProperties().put("openjpa.jdbc.SynchronizeMappings", "buildSchema");
            u.setTransactionType(TransactionType.JTA);
            u.setJtaDataSource("database" + i);
            appModule.getPersistenceModules().add(new PersistenceModule("root", new Persistence(u)));
        }
View Full Code Here

    }

    @Module
    public Persistence persistence() {
        final PersistenceUnit unit = new PersistenceUnit("foo-unit");
        unit.addClass(EntityToValidate.class);
        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
        unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
        unit.setExcludeUnlistedClasses(true);

        final Persistence persistence = new Persistence(unit);
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.