You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2019/01/02 21:18:21 UTC

[10/12] tomee git commit: Adding to jpa group and converting to adoc

Adding to jpa group and converting to adoc


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/d1bf250e
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/d1bf250e
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/d1bf250e

Branch: refs/heads/master
Commit: d1bf250eb6b2a6fe6e56ce42ab095a230a46f991
Parents: 1ddb974
Author: ivanjunckes <ij...@tomitribe.com>
Authored: Wed Jan 2 13:44:26 2019 -0200
Committer: ivanjunckes <ij...@tomitribe.com>
Committed: Wed Jan 2 13:44:26 2019 -0200

----------------------------------------------------------------------
 examples/persistence-fragment/README.adoc | 131 +++++++++++++++++++++++++
 examples/persistence-fragment/README.md   | 130 ------------------------
 2 files changed, 131 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/d1bf250e/examples/persistence-fragment/README.adoc
----------------------------------------------------------------------
diff --git a/examples/persistence-fragment/README.adoc b/examples/persistence-fragment/README.adoc
new file mode 100644
index 0000000..d9fac04
--- /dev/null
+++ b/examples/persistence-fragment/README.adoc
@@ -0,0 +1,131 @@
+= Persistence Fragment
+:index-group: JPA
+:jbake-type: page
+:jbake-status: published
+
+The JPA provides Java developers with an object/relational mapping facility for managing relational data in Java applications.
+
+@Entity define the entity class that you want to convert into a table in a database.
+@Id define the main key of the table.
+@GeneratedValue provides for the specification of generation strategies for the values of primary keys.
+
+== Movie
+
+....
+package org.superbiz.injection.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class Movie {
+    @Id
+    @GeneratedValue
+    private long id;
+    private String director;
+    private String title;
+    private int year;
+
+    public Movie() {
+        // no-op
+    }
+
+    public Movie(String director, String title, int year) {
+        this.director = director;
+        this.title = title;
+        this.year = year;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+}
+....
+
+== persistence-fragment.xml
+
+ <persistence-fragment version="2.0">
+   <persistence-unit-fragment name="movie-unit">
+     <class>org.superbiz.injection.jpa.Movie</class>
+     <exclude-unlisted-classes>true</exclude-unlisted-classes>
+   </persistence-unit-fragment>
+ </persistence-fragment>
+
+== MoviesTest
+
+....
+package org.superbiz.injection.jpa;
+
+import org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class MoviesTest {
+    @PersistenceUnit
+    private EntityManagerFactory emf;
+
+    @Test
+    public void test() throws Exception {
+        final Properties p = new Properties();
+        p.put("movieDatabase", "new://Resource?type=DataSource");
+        p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+        final EJBContainer container = EJBContainer.createEJBContainer(p);
+        final Context context = container.getContext();
+        context.bind("inject", this);
+
+        assertTrue(((ReloadableEntityManagerFactory) emf).getManagedClasses().contains(Movie.class.getName()));
+
+        container.close();
+    }
+}
+....
+
+== persistence.xml
+
+ <persistence version="2.0"
+              xmlns="http://java.sun.com/xml/ns/persistence"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+                        http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+   <persistence-unit name="movie-unit">
+     <jta-data-source>movieDatabase</jta-data-source>
+     <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
+     <properties>
+       <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+     </properties>
+   </persistence-unit>
+ </persistence>

http://git-wip-us.apache.org/repos/asf/tomee/blob/d1bf250e/examples/persistence-fragment/README.md
----------------------------------------------------------------------
diff --git a/examples/persistence-fragment/README.md b/examples/persistence-fragment/README.md
deleted file mode 100644
index a1424a9..0000000
--- a/examples/persistence-fragment/README.md
+++ /dev/null
@@ -1,130 +0,0 @@
-index-group=Unrevised
-type=page
-status=published
-title=Persistence Fragment
-~~~~~~
-
-The JPA provides Java developers with an object/relational mapping facility for managing relational data in Java applications.
-
-@Entity define the entity class that you want to convert into a table in a database.
-@Id define the main key of the table.
-@GeneratedValue provides for the specification of generation strategies for the values of primary keys.
-
-## Movie
-
-    package org.superbiz.injection.jpa;
-    
-    import javax.persistence.Entity;
-    import javax.persistence.GeneratedValue;
-    import javax.persistence.Id;
-    
-    @Entity
-    public class Movie {
-        @Id
-        @GeneratedValue
-        private long id;
-        private String director;
-        private String title;
-        private int year;
-    
-        public Movie() {
-            // no-op
-        }
-    
-        public Movie(String director, String title, int year) {
-            this.director = director;
-            this.title = title;
-            this.year = year;
-        }
-    
-        public long getId() {
-            return id;
-        }
-    
-        public String getDirector() {
-            return director;
-        }
-    
-        public void setDirector(String director) {
-            this.director = director;
-        }
-    
-        public String getTitle() {
-            return title;
-        }
-    
-        public void setTitle(String title) {
-            this.title = title;
-        }
-    
-        public int getYear() {
-            return year;
-        }
-    
-        public void setYear(int year) {
-            this.year = year;
-        }
-    }
-
-## persistence-fragment.xml
-
-    <persistence-fragment version="2.0">
-      <persistence-unit-fragment name="movie-unit">
-        <class>org.superbiz.injection.jpa.Movie</class>
-        <exclude-unlisted-classes>true</exclude-unlisted-classes>
-      </persistence-unit-fragment>
-    </persistence-fragment>
-    
-
-## MoviesTest
-
-    package org.superbiz.injection.jpa;
-    
-    import org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory;
-    import org.junit.Test;
-    
-    import javax.ejb.embeddable.EJBContainer;
-    import javax.naming.Context;
-    import javax.persistence.EntityManagerFactory;
-    import javax.persistence.PersistenceUnit;
-    import java.util.Properties;
-    
-    import static org.junit.Assert.assertTrue;
-    
-    public class MoviesTest {
-        @PersistenceUnit
-        private EntityManagerFactory emf;
-    
-        @Test
-        public void test() throws Exception {
-            final Properties p = new Properties();
-            p.put("movieDatabase", "new://Resource?type=DataSource");
-            p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
-            p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-    
-            final EJBContainer container = EJBContainer.createEJBContainer(p);
-            final Context context = container.getContext();
-            context.bind("inject", this);
-    
-            assertTrue(((ReloadableEntityManagerFactory) emf).getManagedClasses().contains(Movie.class.getName()));
-    
-            container.close();
-        }
-    }
-
-## persistence.xml
-
-    <persistence version="2.0"
-                 xmlns="http://java.sun.com/xml/ns/persistence"
-                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
-                           http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
-      <persistence-unit name="movie-unit">
-        <jta-data-source>movieDatabase</jta-data-source>
-        <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
-        <properties>
-          <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-        </properties>
-      </persistence-unit>
-    </persistence>
-