Author: dadams
Date: Tue Oct 16 05:55:48 2007
New Revision: 585136
URL: http://svn.apache.org/viewvc?rev=585136&view=rev
Log:
Updated the configuration docs
Modified:
tapestry/tapestry5/trunk/tapestry-hibernate/src/site/apt/conf.apt
Modified: tapestry/tapestry5/trunk/tapestry-hibernate/src/site/apt/conf.apt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/site/apt/conf.apt?rev=585136&r1=585135&r2=585136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/src/site/apt/conf.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/src/site/apt/conf.apt Tue Oct
16 05:55:48 2007
@@ -7,11 +7,23 @@
The Tapestry Hibernate Library is responsible for configuring Hibernate for
you. This is done in a just-in-time manner, the first time
a Hibernate Session is required.
- You should create a <<<hibernate.cfg.xml>>> file and place it in the root of
your application (i.e., under src/main/resources). Most Hibernate-specific
- configuration occurs in this file.
+ One way to configure hibernate is to create a <<<hibernate.cfg.xml>>> file
and place it in the root of your application (i.e., under src/main/resources).
Most Hibernate-specific
+ configuration occurs in this file. Another way is to contribute objects that
perform configuration (such as setting event listeners). Example:
- The library gets involved in terms of loading packages and entity class
mappings. This starts with a list of package names.
- For each package, the library will:
++----+
+public static void
contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer>
config)
+{
+ config.add("Widget", new WidgetHibernateConfigurer());
+}
++----+
+
+ Note that the configuration is an OrderedConfiguration. The library
contributes two configurers by default:
+
+ * <<Default>> - performs default hibernate configuration
+
+ * <<PackageName>> - loads entities by package name as contributed to the
HibernateEntityPackageManager service
+
+ For each package contributed the library will:
*
{{{http://www.hibernate.org/hib_docs/annotations/api/org/hibernate/cfg/AnnotationConfiguration.html#addPackage(java.lang.String)}Add
the package to the configuration}},
which will load annotations from the package-info class within the named
package, if present.
@@ -23,13 +35,13 @@
By default, the package <application-root-package>.entities is scanned as
described above. If you have additional packages containing
entities, you must
-
{{{http://tapestry.apache.org/tapestry5/tapestry-ioc/configuration.html}contribute}}
them to the tapestry.hibernate.HibernateSessionSource
+
{{{http://tapestry.apache.org/tapestry5/tapestry-ioc/configuration.html}contribute}}
them to the tapestry.hibernate.HibernateEntityPackageManager
service configuration.
Example:
+----+
-public void contributeHibernateSessionSource(Configuration<String>
configuration)
+public static void
contributeHibernateEntityPackageManager(Configuration<String> configuration)
{
configuration.add("org.example.myapp.domain");
}