From 77c8d31ee173da8eaaa386c020fe65a6cc2f034b Mon Sep 17 00:00:00 2001 From: Emmanuel Bernard Date: Mon, 14 Feb 2011 19:03:51 +0100 Subject: [PATCH] HHH-5916 Add doc for PersisterClassProvider --- .../docbook/en-US/content/configuration.xml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/documentation/manual/src/main/docbook/en-US/content/configuration.xml b/documentation/manual/src/main/docbook/en-US/content/configuration.xml index 8b73de214d..f71a7365da 100644 --- a/documentation/manual/src/main/docbook/en-US/content/configuration.xml +++ b/documentation/manual/src/main/docbook/en-US/content/configuration.xml @@ -1347,6 +1347,48 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect applications. +
+ Implementing a PersisterClassProvider + + You can configure the persister implementation used to persist your + entities and collections: + + + + by default, Hibernate uses persisters that make sense in a + relational model and follow Java Persistence's specification + + + + you can define a PersisterClassProvider + implementation that provides the persister class used of a given + entity or collection + + + + finally, you can override them on a per entity and collection + basis in the mapping using @Persister or its + XML equivalent + + + + The latter in the list the higher in priority. + + You can pass the PersisterClassProvider + instance to the Configuration object. + + SessionFactory sf = new Configuration() + .setPersisterClassProvider(customPersisterClassProvider) + .addAnnotatedClass(Order.class) + .buildSessionFactory(); + + The persister class provider methods, when returning a non null + persister class, override the default Hibernate persisters. The entity + name or the collection role are passed to the methods. It is a nice way to + centralize the overriding logic of the persisters instead of spreading + them on each entity or collection mapping. +
+
XML configuration file