openjpa/openjpa-examples/openbooks/index.html

120 lines
4.8 KiB
HTML
Raw Normal View History

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="keywords" content="JPA, OpenJPA, OpenBooks, Sample, Criteria, MetaModel">
<style type="text/css">
body {
background-color:#FFFFFF;
}
h1 {
color:black;
text-align:center;
}
h2 {
color:blue;
text-align:left;
}
p{
font-family:"Times New Roman";
font-size:20px;
}
</style>
</head>
<body>
<h1>OpenBooks: A sample JPA 2.0 Application</h1>
<hr>
OpenBooks is a sample (and perhaps simple) application to demonstrate some of the new features of
version 2.0 of <A HREF="http://jcp.org/en/jsr/detail?id=317">Java Persistence API</A> (JPA) specification, such as
<br>
<LI>Creating dynamic Criteria Query from an input form
<LI>Using compound, derived identity and orphan delete for modeling composite relationship
<LI>Browsing Persistent Domain Model via MetaModel API
<br>
OpenBooks runs with <A HREF="http://openjpa.apache.org">OpenJPA</A> as its JPA provider.
<hr>
<h2>Instructions to download and run OpenBooks Demo</h2>
OpenBooks comes with complete source code, build scripts to demonstrate how to build a typical OpenJPA application
and scripts to run OpenBooks in on your local database installation. Follow the simple instructions below:
<OL>
<LI><A href="#Download">Download OpenBooks distribution</A>.
<LI><A href="#Build">Build OpenBooks from source</A>
<LI><A href="#Configure">Edit for your local environment to run</A>
<LI><A href="#Load">Populate a Database</A>
<LI><A href="#Run">Run OpenBooks</A>
</OL>
<hr>
<h2 A name="Download">Download Instructions</A></h2>
OpenBooks is distributed under <A HREF="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</A>
<br>
OpenBooks can be checked out from OpenJPA repository.
<br>
<code>$ svn co https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks</code>.
<p>
will check out the source code and build scripts of OpenBooks in current directory.
OpenBooks require following software environment to run:
<OL>
<LI> Java Runtime version 6.0 or higher
<LI> OpenJPA Libraries version 2.0 or higher
<LI> Ant version 1.6 or higher
<LI> Any JDBC complaint database supported by OpenJPA.
See <A href="http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_dbsetup_dbsupport">OpenJPA documentation</A> for a list of supported databases.
</OL>
<hr>
<h2><A name="Build">Build OpenBooks from source</h2>
OpenBooks builds with Ant. Before you run a build, configure the build environment by editing
<A HREF="build.properties"><code>build.properties</code></A>. Essentially you need to point to OpenJPA class library.
The file is commented on what is to be edited. Once you have edited <code>build.properties</code>, simply issue
<br>
<code>$ ant package deploy</code>
<br>
This will compile the source code, generate metamodel classes, enhance the persistence domain model, package
the application and copy it to a <code>target/openbooks</code> directory.
<hr>
<h2><A name="Configure">Edit for your local environment to run</A></h2>
Now go to the <em>deploy</em> directory i.e. <code>target/openbooks</code> directory
<OL>
<LI>Edit <A HREF="run.properties"><code>run.properties</code></A> to specify location of OpenJPA class libraries and JDBC Driver
<LI>Edit <A HREF="META-INF/persistence.xml"><code>META-INF/persistence.xml</code></A> to specify database properties
<LI>Edit <A HREF="load.properties"><code>load.properties</code></A> to specify load parameters such as number of Books etc.
This example file has some typical values. If you are satisfied with it, you can leave them as it is.
</OL>
<hr>
<h2><A name="Load">Populate a Database</A></h2>
Invoke the Ant script to populate the database.<br>
<code>$ ant -f run.xml load</code>
<hr>
<h2><A name="Run">Run OpenBooks</A></h2>
Invoke the Ant script to run OpenBooks<br>
<code>$ ant -f run.xml run</code>
<hr>
</body>
</html>