Hibernate - Core - ConfPage added by Ulrich StärkConfiguring HibernateThe 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. HibernateSessionSource ConfigurationOne 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: public static void contributeHibernateSessionSource(OrderedConfiguration<HibernateConfigurer> config) { config.add("Widget", new WidgetHibernateConfigurer()); }
This configuration is a set of package names, identifying where to search for entity classes. For each package contributed, the library will:
Example: public static void contributeHibernateEntityPackageManager(Configuration<String> configuration) { configuration.add("org.example.myapp.domain"); } You may add as many packages in this manner as you wish. This option is most often used when the entities themselves are contained in a library included within an application, rather than part of the application directly. Hibernate SymbolsThe Hibernate integration includes a number of [symbols|../tapestry-ioc/symbols.html] used to control certain features: tapestry.hibernate.provide-entity-value-encodersIf true (the default) then ValueEncoders are automatically provided for all Hibernate entities (ValueEncoders are used to encode the primary keys of entities as strings that can be included in URLs). Set to false if you want direct control over this feature. tapestry.hibernate.default-configurationIf true (the default), then the application must include a hibernate.cfg.xml file. If your application configures itself entirely in code, you should set this symbol to false. tapestry.hibernate.early-startup If "true", the Hibernate is initialized when the application starts up. The default is "false", to start Hibernate up lazily, on first use.
Change Notification Preferences
View Online
|
- [CONF] Apache Tapestry > Hibernate - Core - Conf confluence
