2010-05-14 12:53:06 -04:00
<!--
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
2010-05-14 17:28:05 -04:00
http://www.apache.org/licenses/LICENSE-2.0
2010-05-14 12:53:06 -04:00
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">
2010-05-13 21:38:18 -04:00
< html >
2010-05-18 17:34:31 -04:00
< 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 >
2010-05-13 21:38:18 -04:00
< 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
2010-05-18 17:34:31 -04:00
version 2.0 of < A HREF = "http://jcp.org/en/jsr/detail?id=317" > Java Persistence API< / A > (JPA) specification, such as
2010-05-13 21:38:18 -04:00
< br >
2010-05-18 17:34:31 -04:00
< 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 >
2010-05-13 21:38:18 -04:00
OpenBooks runs with < A HREF = "http://openjpa.apache.org" > OpenJPA< / A > as its JPA provider.
< hr >
2010-05-18 17:34:31 -04:00
< 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:
2010-05-13 21:38:18 -04:00
< OL >
< LI > < A href = "#Download" > Download OpenBooks distribution< / A > .
2010-05-18 17:34:31 -04:00
< LI > < A href = "#Build" > Build OpenBooks from source< / A >
< LI > < A href = "#Configure" > Edit for your local environment to run< / A >
2010-05-13 21:38:18 -04:00
< 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 >
2010-05-18 17:34:31 -04:00
OpenBooks can be checked out from OpenJPA repository.
< br >
< code > $ svn co https://svn.apache.org/repos/asf/openjpa/trunk/openjpa-examples/openbooks< / code > .
2010-05-13 21:38:18 -04:00
< p >
2010-05-18 17:34:31 -04:00
will check out the source code and build scripts of OpenBooks in current directory.
2010-05-13 21:38:18 -04:00
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 >
2010-05-18 17:34:31 -04:00
< 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
2010-05-13 21:38:18 -04:00
< OL >
2010-05-18 17:34:31 -04:00
< 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.
2010-05-13 21:38:18 -04:00
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 >
2010-05-18 17:34:31 -04:00
2010-05-13 21:38:18 -04:00
< 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 >
2010-05-14 12:53:06 -04:00
< / html >