From de9d4ca8f0168c2b842ce07a2b0b24e730443d74 Mon Sep 17 00:00:00 2001 From: andyjefferson Date: Fri, 15 Apr 2022 15:50:52 +0100 Subject: [PATCH] Fix year on copyright. Add various hyperlinks between sections. --- src/main/asciidoc/object_retrieval.adoc | 8 ++-- src/main/asciidoc/pmf.adoc | 59 +++++++++++++++++++------ src/main/template/document.html.erb | 4 +- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/main/asciidoc/object_retrieval.adoc b/src/main/asciidoc/object_retrieval.adoc index a41b1ee..6f41b79 100644 --- a/src/main/asciidoc/object_retrieval.adoc +++ b/src/main/asciidoc/object_retrieval.adoc @@ -32,7 +32,7 @@ Person per = pm.getObjectById(Person.class, identity); If the object is in the JDO cache (Level 1 or Level 2) then it is retrieved from there, otherwise the JDO implementation goes to the datastore. -When the object is retrieved its fields are populated according to its Fetch Group. +When the object is retrieved its fields are populated according to its link:fetchgroups.html[Fetch Plan]. @@ -65,9 +65,9 @@ It can also be used where you just want to retrieve all persisted objects of a t === Retrieve an object based on a query criteria Where we want to retrieve all objects based on some criteria (e.g all objects of class A where field 'x' of A is a certain value) we need to -use a query language. -The JDO API provides the JDOQL object-based query language where you express your query in terms of classes and fields you are using. -Dependent on your JDO provider and the datastore being used you may also be able to use a (native) query language such as SQL, expressing +use a query language and the link:query_api.html[JDO Query API]. +The JDO API provides the link:jdoql.html[JDOQL] object-based query language where you express your query in terms of classes and fields you are using. +Dependent on your JDO provider and the datastore being used you may also be able to use a (native) query language such as link:query_sql.html[SQL], expressing your query in terms of datastore tables/columns. To give an example of a JDOQL query diff --git a/src/main/asciidoc/pmf.adoc b/src/main/asciidoc/pmf.adoc index c93ef54..19898c2 100644 --- a/src/main/asciidoc/pmf.adoc +++ b/src/main/asciidoc/pmf.adoc @@ -1,3 +1,5 @@ +[[pmf]] += PersistenceManagerFactory :_basedir: :_imagesdir: images/ :notoc: @@ -5,37 +7,34 @@ :grid: cols :usage: -[[index]] - [[Persistence_Manager_Factory]] == Persistence Manager Factory -Any JDO-enabled application will require at least one _PersistenceManagerFactory_. +Any JDO-enabled application will require (at least) one _PersistenceManagerFactory_. Typically applications create one per datastore being utilised. A _PersistenceManagerFactory_ provides access to __PersistenceManager__s which allow objects to be persisted, and retrieved. The _PersistenceManagerFactory_ can be configured to provide particular behaviour. -The simplest way of creating a _PersistenceManagerFactory_ +A simple way of creating a _PersistenceManagerFactory_ link:api32/apidocs/javax/jdo/PersistenceManagerFactory.html[image:images/javadoc.png[image]] -is as follows +is using a set of properties controlling its behaviour, as follows [source,java] .... Properties properties = new Properties(); properties.setProperty("javax.jdo.PersistenceManagerFactoryClass", "{my_implementation_pmf_class}"); -properties.setProperty("javax.jdo.option.ConnectionDriverName", "com.mysql.jdbc.Driver"); properties.setProperty("javax.jdo.option.ConnectionURL", "jdbc:mysql://localhost/myDB"); properties.setProperty("javax.jdo.option.ConnectionUserName", "login"); properties.setProperty("javax.jdo.option.ConnectionPassword", "password"); PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(properties); .... -A slight variation on this, is to use a file ("jdo.properties" for -example) to specify these properties like this + + +A slight variation on this, is to use a file containg these properties (`jdo.properties` for example) to create the PMF, like this .... javax.jdo.PersistenceManagerFactoryClass={my_implementation_pmf_class} -javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver javax.jdo.option.ConnectionURL=jdbc:mysql://localhost/myDB javax.jdo.option.ConnectionUserName=login javax.jdo.option.ConnectionPassword=password @@ -48,8 +47,41 @@ and then to create the _PersistenceManagerFactory_ using this file PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory("jdo.properties"); .... -A final alternative would be to call -_JDOHelper.getPersistenceManagerFactory(jndiLocation, context);_, hence + + +You could alternatively make use of a JPA `persistence.xml` file to create a PMF, like this + +[source,xml] +.... + + + + + mydomain.Product + mydomain.Book + mydomain.CompactDisc + + + + + + + + +.... + +and then instantiate the PMF using the _persistence unit name_, defining the classes that have JDO annotations that make up this application. + +[source,java] +.... +PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory("MyApp"); +.... + + +An alternative using JNDI would be to call _JDOHelper.getPersistenceManagerFactory(jndiLocation, context);_, hence accessing the properties via JNDI. Whichever way we wish to obtain the _PersistenceManagerFactory_ we have defined a series of properties to give the behaviour of the _PersistenceManagerFactory_. @@ -59,7 +91,8 @@ define the datastore that it should connect to. {empty} + -=== Standard JDO Propertiesanchor:Standard_JDO_Properties[] +[[standard_properties]] +=== Standard JDO Properties [cols=",",options="header",] |=== @@ -111,7 +144,7 @@ Range of Values: true \| false Range of Values: true \| false |*javax.jdo.option.Optimistic* -|Whether to use xref:transactions.html[Optimistic transactions]. +|Whether to use xref:transactions.html#locking[Optimistic locking] on transactions. Range of Values: true \| false |*javax.jdo.option.RetainValues* diff --git a/src/main/template/document.html.erb b/src/main/template/document.html.erb index e2156fa..9a597cf 100644 --- a/src/main/template/document.html.erb +++ b/src/main/template/document.html.erb @@ -153,7 +153,6 @@ <% end %> @@ -307,7 +307,7 @@ Latest Javadocs -

© 2005-2021 Apache Software Foundation. All Rights Reserved.

+

© 2005-2022 Apache Software Foundation. All Rights Reserved.

<% end %>