alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (events.pot)

This example Hibernate source code file (events.pot) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

a, a, hibernate, hibernate, if, interceptors, jacc, tag, tag, the, the, this, xml, you

The Hibernate events.pot source code

# 
# AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: 0\n"
"POT-Creation-Date: 2010-02-11T05:38:15\n"
"PO-Revision-Date: 2010-02-11T05:38:15\n"
"Last-Translator: Automatically generated\n"
"Language-Team: None\n"
"MIME-Version: 1.0\n"
"Content-Type: application/x-publican; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Tag: title
#, no-c-format
msgid "Interceptors and events"
msgstr ""

#. Tag: para
#, no-c-format
msgid "It is useful for the application to react to certain events that occur inside Hibernate. This allows for the implementation of generic functionality and the extension of Hibernate functionality."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Interceptors"
msgstr ""

#. Tag: para
#, no-c-format
msgid "The <literal>Interceptor interface provides callbacks from the session to the application, allowing the application to inspect and/or manipulate properties of a persistent object before it is saved, updated, deleted or loaded. One possible use for this is to track auditing information. For example, the following Interceptor automatically sets the createTimestamp when an Auditable is created and updates the lastUpdateTimestamp property when an Auditable is updated."
msgstr ""

#. Tag: para
#, no-c-format
msgid "You can either implement <literal>Interceptor directly or extend EmptyInterceptor."
msgstr ""

#. Tag: para
#, no-c-format
msgid "There are two kinds of inteceptors: <literal>Session-scoped and SessionFactory-scoped."
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <literal>Session-scoped interceptor is specified when a session is opened using one of the overloaded SessionFactory.openSession() methods accepting an Interceptor."
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <literal>SessionFactory-scoped interceptor is registered with the Configuration object prior to building the SessionFactory. Unless a session is opened explicitly specifying the interceptor to use, the supplied interceptor will be applied to all sessions opened from that SessionFactory. SessionFactory-scoped interceptors must be thread safe. Ensure that you do not store session-specific states, since multiple sessions will use this interceptor potentially concurrently."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Event system"
msgstr ""

#. Tag: para
#, no-c-format
msgid "If you have to react to particular events in your persistence layer, you can also use the Hibernate3 <emphasis>event architecture. The event system can be used in addition, or as a replacement, for interceptors."
msgstr ""

#. Tag: para
#, no-c-format
msgid "All the methods of the <literal>Session interface correlate to an event. You have a LoadEvent, a FlushEvent, etc. Consult the XML configuration-file DTD or the org.hibernate.event package for the full list of defined event types. When a request is made of one of these methods, the Hibernate Session generates an appropriate event and passes it to the configured event listeners for that type. Out-of-the-box, these listeners implement the same processing in which those methods always resulted. However, you are free to implement a customization of one of the listener interfaces (i.e., the LoadEvent is processed by the registered implementation of the LoadEventListener interface), in which case their implementation would be responsible for processing any load() requests made of the Session."
msgstr ""

#. Tag: para
#, no-c-format
msgid "The listeners should be considered singletons. This means they are shared between requests, and should not save any state as instance variables."
msgstr ""

#. Tag: para
#, no-c-format
msgid "A custom listener implements the appropriate interface for the event it wants to process and/or extend one of the convenience base classes (or even the default event listeners used by Hibernate out-of-the-box as these are declared non-final for this purpose). Custom listeners can either be registered programmatically through the <literal>Configuration object, or specified in the Hibernate configuration XML. Declarative configuration through the properties file is not supported. Here is an example of a custom load event listener:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "You also need a configuration entry telling Hibernate to use the listener in addition to the default listener:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "Instead, you can register it programmatically:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "Listeners registered declaratively cannot share instances. If the same class name is used in multiple <literal><listener/> elements, each reference will result in a separate instance of that class. If you need to share listener instances between listener types you must use the programmatic registration approach."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Why implement an interface and define the specific type during configuration? A listener implementation could implement multiple event listener interfaces. Having the type additionally defined during registration makes it easier to turn custom listeners on or off during configuration."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Hibernate declarative security"
msgstr ""

#. Tag: para
#, no-c-format
msgid "Usually, declarative security in Hibernate applications is managed in a session facade layer. Hibernate3 allows certain actions to be permissioned via JACC, and authorized via JAAS. This is an optional functionality that is built on top of the event architecture."
msgstr ""

#. Tag: para
#, no-c-format
msgid "First, you must configure the appropriate event listeners, to enable the use of JAAS authorization."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Note that <literal><listener type=\"...\" class=\"...\"/> is shorthand for <event type=\"...\"><listener class=\"...\"/></event> when there is exactly one listener for a particular event type."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Next, while still in <literal>hibernate.cfg.xml, bind the permissions to roles:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "The role names are the roles understood by your JACC provider."
msgstr ""

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate events.pot source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.