⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 events.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 2 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 07:47+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: events.xml:5#, no-c-formatmsgid "Interceptors and events"msgstr "Interceptadores e Eventos"#. Tag: para#: events.xml:7#, no-c-formatmsgid """It is often useful for the application to react to certain events that occur ""inside Hibernate. This allows implementation of certain kinds of generic ""functionality, and extension of Hibernate functionality."msgstr """É muito útil quando a aplicação precisa executar alguma \"coisa\" no momento ""em que o Hibernate executa uma de suas ações. Isso permite a implementação ""de certas funções genéricas, assim como permite estender as funcionalidades ""do Hibernate"#. Tag: title#: events.xml:14#, no-c-formatmsgid "Interceptors"msgstr "Interceptadores"#. Tag: para#: events.xml:16#, no-c-formatmsgid """The <literal>Interceptor</literal> 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</literal> ""automatically sets the <literal>createTimestamp</literal> when an ""<literal>Auditable</literal> is created and updates the ""<literal>lastUpdateTimestamp</literal> property when an <literal>Auditable</""literal> is updated."msgstr """A interface <literal>Interceptor</literal> permite fornecer informações da ""session para o aplicativo, permitindo ao aplicativo inspecionar e/ou ""manipular as propriedades de um objeto persistente antes de ser salvo, ""atualizado, excluído ou salvo. Um dos possíveis usos é gerar informações de ""auditoria. Por exemplo, o seguinte <literal>Interceptor</literal> seta ""automaticamente o atributo <literal>createTimestamp</literal> quando um ""<literal>Auditable</literal> é criada e atualiza o atributo ""<literal>lastUpdateTimestamp</literal> quando um <literal>Auditable</""literal> é atualizado."#. Tag: para#: events.xml:27#, no-c-formatmsgid """You may either implement <literal>Interceptor</literal> directly or (better) ""extend <literal>EmptyInterceptor</literal>."msgstr """Você pode implementar <literal>Auditable</literal> diretamente ou pode ""estender <literal>EmptyInterceptor</literal>, sendo que a segunda é ""considerada a melhor opção."#. Tag: programlisting#: events.xml:32#, no-c-formatmsgid """<![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 ""#. Tag: para#: events.xml:34#, no-c-formatmsgid """Interceptors come in two flavors: <literal>Session</literal>-scoped and ""<literal>SessionFactory</literal>-scoped."msgstr """Os interceptadores podem ser aplicados em dois diferentes escopos: No escopo ""da <literal>Session</literal> e no escopo <literal>SessionFactory</literal>."#. Tag: para#: events.xml:39#, no-c-formatmsgid """A <literal>Session</literal>-scoped interceptor is specified when a session ""is opened using one of the overloaded SessionFactory.openSession() methods ""accepting an <literal>Interceptor</literal>."msgstr """Um interceptador no escopo da <literal>Session</literal> é definido quando ""uma sessão é aberta usando o método sobrecarregado da SessionFactory.""openSession() que aceita um <literal>Interceptor</literal> como parâmetro."#. Tag: programlisting#: events.xml:45#, no-c-formatmsgid "<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"msgstr ""#. Tag: para#: events.xml:47#, no-c-formatmsgid """A <literal>SessionFactory</literal>-scoped interceptor is registered with ""the <literal>Configuration</literal> object prior to building the ""<literal>SessionFactory</literal>. In this case, the supplied interceptor ""will be applied to all sessions opened from that <literal>SessionFactory</""literal>; this is true unless a session is opened explicitly specifying the ""interceptor to use. <literal>SessionFactory</literal>-scoped interceptors ""must be thread safe, taking care to not store session-specific state since ""multiple sessions will use this interceptor (potentially) concurrently."msgstr """Um interceptador no escopo da <literal>SessionFactory</literal> é definido ""no objeto <literal>Configuration</literal> antes da <literal>SessionFactory</""literal> ser instanciada. Nesse caso, o interceptador fornecido será ""aplicado para todas as sessões abertas por aquela <literal>SessionFactory</""literal>; Isso apenas não ocorrerá caso seja especificado um interceptador ""no momento em que a sessão for aberta. Um interceptador no escopo de ""<literal>SessionFactory</literal> deve ser thread safe, tomando-se o cuidado ""de não armazenar atributos de estado específicos da sessão, pois, ""provavelmente, múltiplas sessões irão utilizar esse interceptador ""simultaneamente."#. Tag: programlisting#: events.xml:56#, no-c-formatmsgid """<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"msgstr ""#. Tag: title#: events.xml:61#, no-c-formatmsgid "Event system"msgstr "Sistema de Eventos"#. Tag: para#: events.xml:63#, no-c-formatmsgid """If you have to react to particular events in your persistence layer, you may ""also use the Hibernate3 <emphasis>event</emphasis> architecture. The event ""system can be used in addition or as a replacement for interceptors."msgstr """Se você precisa executar uma ação em determinados eventos da camada de ""persistência, você também pode usar a arquitetura de <emphasis>event</""emphasis> do Hibernate3. Um evento do sistema pode ser utilizado como ""complemento ou em substituição a um interceptador."#. Tag: para#: events.xml:69

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -