|
Hibernate example source code file (events.po)
This example Hibernate source code file (events.po) 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.
The Hibernate events.po source code
# translation of Collection_Mapping.po to
# Xi HUANG <xhuang@redhat.com>, 2007, 2010.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-10T07:25:34\n"
"PO-Revision-Date: 2010-01-13 11:47+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team: <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\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 ""
"アプリケーション㌠Hibernate ã®å†…部ã§ç™ºç”Ÿã™ã‚‹ã‚¤ãƒ™ãƒ³ãƒˆã«å¯¾å¿œã§ãã‚‹ã¨å½¹ã«ç«‹ã¤ã“"
"ã¨ãŒã‚ã‚Šã¾ã™ã€‚ã‚る種ã®ä¸€èˆ¬çš„ãªæ©Ÿèƒ½ã‚’実装ã§ãるよã†ã«ãªã‚Šã€ã¾ãŸ Hibernate ã®æ©Ÿ"
"能を拡張ã™ã‚‹ã“ã¨ã‚‚ã§ãるよã†ã«ãªã‚Šã¾ã™ã€‚"
#. 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 <literal>Interceptor "
"automatically sets the <literal>createTimestamp when an "
"<literal>Auditable is created and updates the "
"<literal>lastUpdateTimestamp property when an Auditable インターフェースを使ã£ã¦ã€ã‚»ãƒƒã‚·ãƒ§ãƒ³ã‹ã‚‰ã‚¢ãƒ—リ"
"ケーションã¸ã‚³ãƒ¼ãƒ«ãƒãƒƒã‚¯ã‚’ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ã“ã‚Œã«ã‚ˆã‚Šæ°¸ç¶šã‚ªãƒ–ジェクトã®ä¿"
"å˜ã€æ›´æ–°ã€å‰Šé™¤ã€èªã¿è¾¼ã¿ã®å‰ã«ã€ã‚¢ãƒ—リケーションãŒãƒ—ãƒãƒ‘ティを検査ã—ãŸã‚Šæ“作"
"ã—ãŸã‚Šã§ãるよã†ã«ãªã‚Šã¾ã™ã€‚ã“ã‚Œã¯ç›£æŸ»æƒ…å ±ã®è¿½è·¡ã«åˆ©ç”¨ã§ãã¾ã™ã€‚下ã®ä¾‹ã§ "
"<literal>Interceptor 㯠Auditable ãŒä½œæˆã•ã‚Œã‚‹ã¨"
"自動的㫠<literal>createTimestamp ã‚’è¨å®šã—〠AuditablelastUpdateTimestamp プãƒãƒ‘"
"ティを更新ã—ã¾ã™ã€‚"
#. Tag: para
#, no-c-format
msgid ""
"You can either implement <literal>Interceptor directly or extend "
"<literal>EmptyInterceptor."
msgstr ""
"<literal>Interceptor を直接実装ã—ãŸã‚Šã€ (ã•ã‚‰ã«ã‚ˆã„ã®ã¯ï¼‰ "
"<literal>EmptyInterceptor ã‚’æ‹¡å¼µã—ãŸã‚Šã§ãã¾ã™ã€‚"
#. Tag: para
#, no-c-format
msgid ""
"There are two kinds of inteceptors: <literal>Session-scoped and "
"<literal>SessionFactory-scoped."
msgstr ""
"インターセプタã«ã¯äºŒç¨®é¡žã‚ã‚Šã¾ã™ï¼š <literal>Session スコープã®ã‚‚ã®"
"㨠<literal>SessionFactory スコープã®ã‚‚ã®ã§ã™ã€‚"
#. 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 <literal>Interceptor."
msgstr ""
"<literal>Session スコープã®ã‚¤ãƒ³ã‚¿ãƒ¼ã‚»ãƒ—ã‚¿ã¯ã€ã‚»ãƒƒã‚·ãƒ§ãƒ³ã‚’オープンã™"
"ã‚‹ã¨ãã«æŒ‡å®šã—ã¾ã™ã€‚ <literal>Interceptor を引数ã«å–ã‚‹ "
"SessionFactory.openSession() ã®ã‚ªãƒ¼ãƒãƒ¼ãƒãƒ¼ãƒ‰ãƒ¡ã‚½ãƒƒãƒ‰ã®ä¸€ã¤ã‚’使ã„ã¾ã™ã€‚"
#. Tag: para
#, no-c-format
msgid ""
"A <literal>SessionFactory-scoped interceptor is registered with "
"the <literal>Configuration object prior to building the "
"<literal>SessionFactory. Unless a session is opened explicitly "
"specifying the interceptor to use, the supplied interceptor will be applied "
"to all sessions opened from that <literal>SessionFactory. "
"<literal>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 ""
"<literal>SessionFactory スコープã®ã‚¤ãƒ³ã‚¿ãƒ¼ã‚»ãƒ—タ㯠"
"<literal>Configuration オブジェクトを使ã£ã¦ç™»éŒ²ã—ã¾ã™ã€‚ã“れ㯠"
"<literal>SessionFactory ã®æ§‹ç¯‰ã‚ˆã‚Šã‚‚優先ã•ã‚Œã¾ã™ã€‚ã“ã®å ´åˆã€æä¾›ã•"
"れるインターセプタ㯠<literal>SessionFactory ã‹ã‚‰ã‚ªãƒ¼ãƒ—ンã•ã‚ŒãŸã™ã¹"
"ã¦ã®ã‚»ãƒƒã‚·ãƒ§ãƒ³ã«é©ç”¨ã•ã‚Œã¾ã™ã€‚ã“ã‚Œã¯ä½¿ç”¨ã™ã‚‹ã‚¤ãƒ³ã‚¿ãƒ¼ã‚»ãƒ—タを明示的ã«æŒ‡å®šã—ã¦"
"セッションをオープンã—ãªã„é™ã‚Šã€ãã†ãªã‚Šã¾ã™ã€‚ <literal>SessionFactory architecture. The event "
"system can be used in addition, or as a replacement, for interceptors."
msgstr ""
"永続化層ã§ç‰¹å®šã®ã‚¤ãƒ™ãƒ³ãƒˆã«å¯¾å¿œã—ãªã‘ã‚Œã°ãªã‚‰ãªã„å ´åˆã€ Hibernate3 ã® "
"<emphasis>イベント アーã‚テクãƒãƒ£ã‚’使ã†ã“ã¨ã‚‚ã§ãã¾ã™ã€‚イベントシ"
"ステムã¯ã‚¤ãƒ³ã‚¿ãƒ¼ã‚»ãƒ—ã‚¿ã¨ä¸€ç·’ã«ä½¿ã†ã‹ã€ã¾ãŸã¯ã‚¤ãƒ³ã‚¿ãƒ¼ã‚»ãƒ—ã‚¿ã®ä»£ã‚ã‚Šã¨ã—ã¦ä½¿ã†"
"ã“ã¨ãŒã§ãã¾ã™ã€‚"
#. Tag: para
#, no-c-format
msgid ""
"All the methods of the <literal>Session interface correlate to an "
"event. You have a <literal>LoadEvent, a FlushEventorg."
"hibernate.event</literal> package for the full list of defined event types. "
"When a request is made of one of these methods, the Hibernate "
"<literal>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 <literal>LoadEvent is processed by "
"the registered implementation of the <literal>LoadEventListener "
"interface), in which case their implementation would be responsible for "
"processing any <literal>load() requests made of the "
"<literal>Session."
msgstr ""
"本質的㫠<literal>Session インターフェースã®ã™ã¹ã¦ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯ã€1個"
"ã®ã‚¤ãƒ™ãƒ³ãƒˆã¨ç›¸äº’ã«é–¢é€£ã—ã¾ã™ã€‚例ãˆã° <literal>LoadEvent 〠"
"<literal>FlushEvent ãªã©ãŒã‚ã‚Šã¾ã™ (定義済ã¿ã®ã‚¤ãƒ™ãƒ³ãƒˆåž‹ã®ä¸€è¦§ã«ã¤"
"ã„ã¦ã¯ã€ XML è¨å®šãƒ•ã‚¡ã‚¤ãƒ«ã® DTD ã‚„ <literal>org.hibernate.event "
"パッケージを調ã¹ã¦ãã ã•ã„) 。リクエストãŒã“れらã®ãƒ¡ã‚½ãƒƒãƒ‰ã®1ã¤ã‹ã‚‰ä½œã‚‰ã‚Œã‚‹"
"ã¨ã〠Hibernate ã® <literal>Session ã¯é©åˆ‡ãªã‚¤ãƒ™ãƒ³ãƒˆã‚’生æˆã—ã€ãã®"
"イベント型ã«è¨å®šã•ã‚ŒãŸã‚¤ãƒ™ãƒ³ãƒˆãƒªã‚¹ãƒŠã«æ¸¡ã—ã¾ã™ã€‚ã™ã°ã‚‰ã—ã„ã“ã¨ã«ã€ã“れらã®ãƒª"
"スナã¯ãã®ãƒ¡ã‚½ãƒƒãƒ‰ã¨åŒã˜å‡¦ç†ã‚’実装ã—ã¾ã™ã€‚ã¨ã¯ã„ãˆã€ãƒªã‚¹ãƒŠã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ãƒ¼ã‚¹ã®"
"一ã¤ã‚’自由ã«ã‚«ã‚¹ã‚¿ãƒ 実装ã§ãã¾ã™ (ã¤ã¾ã‚Šã€ <literal>LoadEvent ã¯ç™»"
"録ã•ã‚ŒãŸ <literal>LoadEventListener インターフェースã®å®Ÿè£…ã«ã‚ˆã‚Šå‡¦"
"ç†ã•ã‚Œã¾ã™ï¼‰ã€‚ãã®å ´åˆã€ãã®å®Ÿè£…ã«ã¯ <literal>Session ã‹ã‚‰ä½œã‚‰ã‚ŒãŸ"
"ã©ã®ã‚ˆã†ãª <literal>load() リクエストをも処ç†ã™ã‚‹è²¬ä»»ãŒã‚ã‚Šã¾ã™ã€‚"
#. 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 ""
"カスタムリスナã¯å‡¦ç†ã—ãŸã„イベントã«ã¤ã„ã¦é©åˆ‡ãªã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ãƒ¼ã‚¹ã‚’実装ã™ã‚‹ã¹"
"ãã§ã™ã€‚便利ãªåŸºåº•ã‚¯ãƒ©ã‚¹ã®ã†ã¡ã®ä¸€ã¤ã‚’継承ã—ã¦ã‚‚よã„ã§ã™ (ã¾ãŸã¯ Hibernate "
"ãŒãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã§ä½¿ç”¨ã™ã‚‹ã‚¤ãƒ™ãƒ³ãƒˆãƒªã‚¹ãƒŠã‚’継承ã—ã¦ã‚‚よã„ã§ã™ã€‚ã™ã°ã‚‰ã—ã„ã“ã¨ã«ã€"
"ã“ã®ç›®çš„ã®ãŸã‚ã«éž final ã¨ã—ã¦å®£è¨€ã•ã‚Œã¦ã„ã¾ã™ï¼‰ 。カスタムリスナ㯠"
"<literal>Configuration オブジェクトを使ã£ã¦ãƒ—ãƒã‚°ãƒ©ãƒ ã‹ã‚‰ç™»éŒ²ã™ã‚‹"
"ã‹ã€ Hibernate ã® XML è¨å®šãƒ•ã‚¡ã‚¤ãƒ«ã§æŒ‡å®šã§ãã¾ã™ (プãƒãƒ‘ティファイルã§å®£è¨€çš„"
"ã«è¨å®šã™ã‚‹æ–¹æ³•ã¯ã‚µãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ã¾ã›ã‚“) 。カスタムãƒãƒ¼ãƒ‰ã‚¤ãƒ™ãƒ³ãƒˆãƒªã‚¹ãƒŠã®ä¾‹ã‚’"
"示ã—ã¾ã™:"
#. 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 ""
"デフォルトリスナ以外ã®ãƒªã‚¹ãƒŠã‚’使ã†ã«ã¯ã€ Hibernate ã¸ã®è¨å®šã‚‚å¿…è¦ã§ã™ï¼š"
#. 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 ""
"リスナを宣言的ã«ç™»éŒ²ã™ã‚‹ã¨ã€ãã®ãƒªã‚¹ãƒŠã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’共有ã§ãã¾ã›ã‚“。複数㮠"
"<literal><listener/> è¦ç´ ã§åŒã˜ã‚¯ãƒ©ã‚¹åãŒä½¿ã‚れるã¨ã€ãã‚Œãžã‚Œ"
"ã®å‚ç…§ã¯ãã®ã‚¯ãƒ©ã‚¹ã®åˆ¥ã€…ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã‚’指ã™ã“ã¨ã«ãªã‚Šã¾ã™ã€‚リスナ型ã®é–“ã§ãƒª"
"スナインスタンスを共有ã™ã‚‹å¿…è¦ãŒã‚ã‚Œã°ã€ãƒ—ãƒã‚°ãƒ©ãƒ ã§ç™»éŒ²ã™ã‚‹æ–¹æ³•ã‚’採らãªã‘ã‚Œ"
"ã°ãªã‚Šã¾ã›ã‚“。"
#. 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 ""
"ãªãœã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ãƒ¼ã‚¹ã‚’実装ã—ã¦ã€ç‰¹åŒ–ã—ãŸåž‹ã‚’è¨å®šæ™‚ã«æŒ‡å®šã™ã‚‹ã®ã§ã—ょã†ã‹ï¼Ÿãƒª"
"スナã®å®Ÿè£…クラスã«ã€è¤‡æ•°ã®ã‚¤ãƒ™ãƒ³ãƒˆãƒªã‚¹ãƒŠã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ãƒ¼ã‚¹ã‚’実装ã§ãã‚‹ã‹ã‚‰ã§"
"ã™ã€‚登録時ã«è¿½åŠ ã§åž‹ã‚’指定ã™ã‚‹ã“ã¨ã§ã€ã‚«ã‚¹ã‚¿ãƒ リスナ㮠on/off ã‚’è¨å®šæ™‚ã«ç°¡å˜"
"ã«åˆ‡ã‚Šæ›¿ãˆã‚‰ã‚Œã¾ã™ã€‚"
#. Tag: title
#, no-c-format
msgid "Hibernate declarative security"
msgstr "Hibernate ã®å®£è¨€çš„ãªã‚»ã‚ュリティ"
#. 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 ""
"一般的㫠Hibernate アプリケーションã®å®£è¨€çš„ãªã‚»ã‚ュリティã¯ã€ã‚»ãƒƒã‚·ãƒ§ãƒ³ãƒ•ã‚¡"
"サード層ã§ç®¡ç†ã—ã¾ã™ã€‚ç¾åœ¨ã€ Hiberenate3 㯠JACC ã§è¨±å¯ã—ã€ã•ã‚‰ã« JAAS ã§èªè¨¼"
"ã—ãŸã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã‚’許ã—ã¦ã„ã¾ã™ã€‚ã“ã‚Œã¯ã‚¤ãƒ™ãƒ³ãƒˆã‚¢ãƒ¼ã‚テクãƒãƒ£ã®æœ€ä¸Šä½ã«çµ„ã¿è¾¼ã¾"
"ã‚Œã¦ã„るオプションã®æ©Ÿèƒ½ã§ã™ã€‚"
#. Tag: para
#, no-c-format
msgid ""
"First, you must configure the appropriate event listeners, to enable the use "
"of JAAS authorization."
msgstr ""
"ã¾ãšæœ€åˆã«ã€é©åˆ‡ãªã‚¤ãƒ™ãƒ³ãƒˆãƒªã‚¹ãƒŠã‚’è¨å®šã—㦠JAAS èªè¨¼ã‚’使ãˆã‚‹ã‚ˆã†ã«ã—ãªã‘ã‚Œã°"
"ãªã‚Šã¾ã›ã‚“。"
#. Tag: para
#, no-c-format
msgid ""
"Note that <literal><listener type=\"...\" class=\"...\"/> is "
"shorthand for <literal><event type=\"...\"><listener class=\"...\"/"
"></event></literal> when there is exactly one listener for a "
"particular event type."
msgstr ""
"特定ã®ã‚¤ãƒ™ãƒ³ãƒˆåž‹ã«å¯¾ã—ã¦ã¡ã‚‡ã†ã©ä¸€ã¤ã®ãƒªã‚¹ãƒŠãŒã‚ã‚‹ã¨ã〠<literal><"
"listener type=\"...\" class=\"...\"/></literal> 㯠<event "
"type=\"...\"><listener class=\"...\"/></event></literal> ã®ç°¡"
"略形ã«éŽãŽãªã„ã“ã¨ã«æ³¨æ„ã—ã¦ãã ã•ã„。"
#. Tag: para
#, no-c-format
msgid ""
"Next, while still in <literal>hibernate.cfg.xml, bind the "
"permissions to roles:"
msgstr ""
"次ã«ã€åŒã˜ã <literal>hibernate.cfg.xml ã§ãƒãƒ¼ãƒ«ã«ãƒ‘ーミッションを"
"与ãˆã¦ãã ã•ã„:"
#. Tag: para
#, no-c-format
msgid "The role names are the roles understood by your JACC provider."
msgstr "ã“ã®ãƒãƒ¼ãƒ«åã¯ä½¿ç”¨ã™ã‚‹ JACC プãƒãƒã‚¤ãƒ€ã«ç†è§£ã•ã‚Œã‚‹ãƒãƒ¼ãƒ«ã§ã™ã€‚"
#, fuzzy
#~ msgid ""
#~ "<![CDATA[package org.hibernate.test;\n"
#~ "\n"
#~ "import java.io.Serializable;\n"
#~ "import java.util.Date;\n"
#~ "import java.util.Iterator;\n"
#~ "\n"
#~ "import org.hibernate.EmptyInterceptor;\n"
#~ "import org.hibernate.Transaction;\n"
#~ "import org.hibernate.type.Type;\n"
#~ "\n"
#~ "public class AuditInterceptor extends EmptyInterceptor {\n"
#~ "\n"
#~ " private int updates;\n"
#~ " private int creates;\n"
#~ " private int loads;\n"
#~ "\n"
#~ " public void onDelete(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] state,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ " // do nothing\n"
#~ " }\n"
#~ "\n"
#~ " public boolean onFlushDirty(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] currentState,\n"
#~ " Object[] previousState,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ "\n"
#~ " if ( entity instanceof Auditable ) {\n"
#~ " updates++;\n"
#~ " for ( int i=0; i < propertyNames.length; i++ ) {\n"
#~ " if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) "
#~ "{\n"
#~ " currentState[i] = new Date();\n"
#~ " return true;\n"
#~ " }\n"
#~ " }\n"
#~ " }\n"
#~ " return false;\n"
#~ " }\n"
#~ "\n"
#~ " public boolean onLoad(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] state,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ " if ( entity instanceof Auditable ) {\n"
#~ " loads++;\n"
#~ " }\n"
#~ " return false;\n"
#~ " }\n"
#~ "\n"
#~ " public boolean onSave(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] state,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ "\n"
#~ " if ( entity instanceof Auditable ) {\n"
#~ " creates++;\n"
#~ " for ( int i=0; i<propertyNames.length; i++ ) {\n"
#~ " if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
#~ " state[i] = new Date();\n"
#~ " return true;\n"
#~ " }\n"
#~ " }\n"
#~ " }\n"
#~ " return false;\n"
#~ " }\n"
#~ "\n"
#~ " public void afterTransactionCompletion(Transaction tx) {\n"
#~ " if ( tx.wasCommitted() ) {\n"
#~ " System.out.println(\"Creations: \" + creates + \", Updates: "
#~ "\" + updates, \"Loads: \" + loads);\n"
#~ " }\n"
#~ " updates=0;\n"
#~ " creates=0;\n"
#~ " loads=0;\n"
#~ " }\n"
#~ "\n"
#~ "}]]>"
#~ msgstr ""
#~ "package org.hibernate.test;\n"
#~ "\n"
#~ "import java.io.Serializable;\n"
#~ "import java.util.Date;\n"
#~ "import java.util.Iterator;\n"
#~ "\n"
#~ "import org.hibernate.EmptyInterceptor;\n"
#~ "import org.hibernate.Transaction;\n"
#~ "import org.hibernate.type.Type;\n"
#~ "\n"
#~ "public class AuditInterceptor extends EmptyInterceptor {\n"
#~ "\n"
#~ " private int updates;\n"
#~ " private int creates;\n"
#~ " private int loads;\n"
#~ "\n"
#~ " public void onDelete(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] state,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ " // do nothing\n"
#~ " }\n"
#~ "\n"
#~ " public boolean onFlushDirty(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] currentState,\n"
#~ " Object[] previousState,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ "\n"
#~ " if ( entity instanceof Auditable ) {\n"
#~ " updates++;\n"
#~ " for ( int i=0; i < propertyNames.length; i++ ) {\n"
#~ " if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) "
#~ "{\n"
#~ " currentState[i] = new Date();\n"
#~ " return true;\n"
#~ " }\n"
#~ " }\n"
#~ " }\n"
#~ " return false;\n"
#~ " }\n"
#~ "\n"
#~ " public boolean onLoad(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] state,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ " if ( entity instanceof Auditable ) {\n"
#~ " loads++;\n"
#~ " }\n"
#~ " return false;\n"
#~ " }\n"
#~ "\n"
#~ " public boolean onSave(Object entity,\n"
#~ " Serializable id,\n"
#~ " Object[] state,\n"
#~ " String[] propertyNames,\n"
#~ " Type[] types) {\n"
#~ "\n"
#~ " if ( entity instanceof Auditable ) {\n"
#~ " creates++;\n"
#~ " for ( int i=0; i<propertyNames.length; i++ ) {\n"
#~ " if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
#~ " state[i] = new Date();\n"
#~ " return true;\n"
#~ " }\n"
#~ " }\n"
#~ " }\n"
#~ " return false;\n"
#~ " }\n"
#~ "\n"
#~ " public void afterTransactionCompletion(Transaction tx) {\n"
#~ " if ( tx.wasCommitted() ) {\n"
#~ " System.out.println(\"Creations: \" + creates + \", Updates: "
#~ "\" + updates,\n"
#~ " \"Loads: \" + loads);\n"
#~ " }\n"
#~ " updates=0;\n"
#~ " creates=0;\n"
#~ " loads=0;\n"
#~ " }\n"
#~ "\n"
#~ "}"
#, fuzzy
#~ msgid ""
#~ "<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"
#~ msgstr "Session session = sf.openSession( new AuditInterceptor() );"
#, fuzzy
#~ msgid ""
#~ "<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
#~ msgstr "new Configuration().setInterceptor( new AuditInterceptor() );"
#, fuzzy
#~ msgid ""
#~ "<![CDATA[public class MyLoadListener implements LoadEventListener {\n"
#~ " // this is the single method defined by the LoadEventListener "
#~ "interface\n"
#~ " public void onLoad(LoadEvent event, LoadEventListener.LoadType "
#~ "loadType)\n"
#~ " throws HibernateException {\n"
#~ " if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
#~ "getEntityId() ) ) {\n"
#~ " throw MySecurityException(\"Unauthorized access\");\n"
#~ " }\n"
#~ " }\n"
#~ "}]]>"
#~ msgstr ""
#~ "public class MyLoadListener implements LoadEventListener {\n"
#~ " // this is the single method defined by the LoadEventListener "
#~ "interface\n"
#~ " public void onLoad(LoadEvent event, LoadEventListener.LoadType "
#~ "loadType)\n"
#~ " throws HibernateException {\n"
#~ " if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
#~ "getEntityId() ) ) {\n"
#~ " throw MySecurityException(\"Unauthorized access\");\n"
#~ " }\n"
#~ " }\n"
#~ "}"
#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<hibernate-configuration>\n"
#~ " <session-factory>\n"
#~ " ...\n"
#~ " <event type=\"load\">\n"
#~ " <listener class=\"com.eg.MyLoadListener\"/>\n"
#~ " <listener class=\"org.hibernate.event.def."
#~ "DefaultLoadEventListener\"/>\n"
#~ " </event>\n"
#~ " </session-factory>\n"
#~ "</hibernate-configuration>"
#, fuzzy
#~ msgid ""
#~ "<![CDATA[Configuration cfg = new Configuration();\n"
#~ "LoadEventListener[] stack = { new MyLoadListener(), new "
#~ "DefaultLoadEventListener() };\n"
#~ "cfg.EventListeners().setLoadEventListeners(stack);]]>"
#~ msgstr ""
#~ "Configuration cfg = new Configuration();\n"
#~ "LoadEventListener[] stack = { new MyLoadListener(), new "
#~ "DefaultLoadEventListener() };\n"
#~ "cfg.EventListeners().setLoadEventListeners(stack);"
#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<listener type=\"pre-delete\" class=\"org.hibernate.secure."
#~ "JACCPreDeleteEventListener\"/>\n"
#~ "<listener type=\"pre-update\" class=\"org.hibernate.secure."
#~ "JACCPreUpdateEventListener\"/>\n"
#~ "<listener type=\"pre-insert\" class=\"org.hibernate.secure."
#~ "JACCPreInsertEventListener\"/>\n"
#~ "<listener type=\"pre-load\" class=\"org.hibernate.secure."
#~ "JACCPreLoadEventListener\"/>"
#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,read"
#~ "\"/>\n"
#~ "<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>"
Other Hibernate examples (source code examples)
Here is a short list of links related to this Hibernate events.po source code file:
|