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

📄 filters.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2008-08-14 15:28+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#: filters.xml:29#, no-c-formatmsgid "Filtering data"msgstr "过滤数据"#. Tag: para#: filters.xml:31#, no-c-formatmsgid """Hibernate3 provides an innovative new approach to handling data with ""\"visibility\" rules. A <emphasis>Hibernate filter</emphasis> is a global, ""named, parameterized filter that may be enabled or disabled for a particular ""Hibernate session."msgstr """Hibernate3 提供了一种创新的方式来处理具有“显性(visibility)”规则的数据,那就是""使用<emphasis>Hibernate filter</emphasis>。 <emphasis>Hibernate filter</""emphasis>是全局有效的、具有名字、可以带参数的过滤器, 对于某个特定的""Hibernate session您可以选择是否启用(或禁用)某个过滤器。"#. Tag: title#: filters.xml:38#, no-c-formatmsgid "Hibernate filters"msgstr "Hibernate 过滤器(filters)"#. Tag: para#: filters.xml:40#, no-c-formatmsgid """Hibernate3 adds the ability to pre-define filter criteria and attach those ""filters at both a class and a collection level. A filter criteria is the ""ability to define a restriction clause very similiar to the existing \"where""\" attribute available on the class and various collection elements. Except ""these filter conditions can be parameterized. The application can then make ""the decision at runtime whether given filters should be enabled and what ""their parameter values should be. Filters can be used like database views, ""but parameterized inside the application."msgstr """Hibernate3新增了对某个类或者集合使用预先定义的过滤器条件(filter criteria)的功""能。过滤器条件相当于定义一个 非常类似于类和各种集合上的“where”属性的约束子""句,但是过滤器条件可以带参数。 应用程序可以在运行时决定是否启用给定的过滤器,""以及使用什么样的参数值。 过滤器的用法很像数据库视图,只不过是在应用程序中确定""使用什么样的参数的。"#. Tag: para#: filters.xml:50#, no-c-formatmsgid """In order to use filters, they must first be defined and then attached to the ""appropriate mapping elements. To define a filter, use the <literal>&lt;""filter-def/&gt;</literal> element within a <literal>&lt;hibernate-mapping/""&gt;</literal> element:"msgstr """要使用过滤器,必须首先在相应的映射节点中定义。而定义一个过滤器,要用到位于""<literal>&lt;hibernate-mapping/&gt;</literal> 节点之内的<literal>&lt;filter-""def/&gt;</literal>节点:"#. Tag: programlisting#: filters.xml:56#, no-c-formatmsgid """<![CDATA[<filter-def name=\"myFilter\">\n""    <filter-param name=\"myFilterParam\" type=\"string\"/>\n""</filter-def>]]>"msgstr ""#. Tag: para#: filters.xml:58#, no-c-formatmsgid "Then, this filter can be attached to a class:"msgstr "定义好之后,就可以在某个类中使用这个过滤器:"#. Tag: programlisting#: filters.xml:62#, no-c-formatmsgid """<![CDATA[<class name=\"myClass\" ...>\n""    ...\n""    <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN""\"/>\n""</class>]]>"msgstr ""#. Tag: para#: filters.xml:64#, no-c-formatmsgid "or, to a collection:"msgstr "也可以在某个集合使用它:"#. Tag: programlisting#: filters.xml:68#, no-c-formatmsgid """<![CDATA[<set ...>\n""    <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN""\"/>\n""</set>]]>"msgstr ""#. Tag: para#: filters.xml:70#, no-c-formatmsgid "or, even to both (or multiples of each) at the same time."msgstr """可以在多个类或集合中使用某个过滤器;某个类或者集合中也可以使用多个过滤器。"#. Tag: para#: filters.xml:74#, fuzzy, no-c-formatmsgid """The methods on <literal>Session</literal> are: <literal>enableFilter(String ""filterName)</literal>, <literal>getEnabledFilter(String filterName)</""literal>, and <literal>disableFilter(String filterName)</literal>. By ""default, filters are <emphasis>not</emphasis> enabled for a given session; ""they must be explcitly enabled through use of the <literal>Session.""enableFilter()</literal> method, which returns an instance of the ""<literal>Filter</literal> interface. Using the simple filter defined above, ""this would look like:"msgstr """<literal>Session</literal>对象中会用到的方法有:<literal>enableFilter(String ""filterName)</literal>, <literal>getEnabledFilter(String filterName)</""literal>, 和 <literal>disableFilter(String filterName)</literal>. Session中默""认是<emphasis>不</emphasis>启用过滤器的,必须通过<literal>Session.""enabledFilter()</literal>方法显式的启用。 该方法返回被启用的<literal>Filter</""literal>的实例。以上文定义的过滤器为例:"#. Tag: programlisting#: filters.xml:83#, no-c-formatmsgid """<![CDATA[session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", ""\"some-value\");]]>"msgstr ""#. Tag: para#: filters.xml:85#, no-c-formatmsgid """Note that methods on the org.hibernate.Filter interface do allow the method-""chaining common to much of Hibernate."msgstr """注意,org.hibernate.Filter的方法允许链式方法调用。(类似上面例子中启用Filter""之后设定Filter参数这个“方法链”) Hibernate的其他部分也大多有这个特性。"#. Tag: para#: filters.xml:89#, no-c-formatmsgid """A full example, using temporal data with an effective record date pattern:"msgstr "下面是一个比较完整的例子,使用了记录生效日期模式过滤有时效的数据:"#. Tag: programlisting#: filters.xml:93#, no-c-formatmsgid """<![CDATA[<filter-def name=\"effectiveDate\">\n""    <filter-param name=\"asOfDate\" type=\"date\"/>\n""</filter-def>\n""\n""<class name=\"Employee\" ...>\n""...\n""    <many-to-one name=\"department\" column=\"dept_id\" class=\"Department\"/"">\n""    <property name=\"effectiveStartDate\" type=\"date\" column=\"eff_start_dt""\"/>\n""    <property name=\"effectiveEndDate\" type=\"date\" column=\"eff_end_dt\"/"">\n""...\n""    <!--\n""        Note that this assumes non-terminal records have an eff_end_dt set ""to\n""        a max db date for simplicity-sake\n""    -->\n""    <filter name=\"effectiveDate\"\n""            condition=\":asOfDate BETWEEN eff_start_dt and eff_end_dt\"/>\n""</class>\n""\n""<class name=\"Department\" ...>\n""...\n""    <set name=\"employees\" lazy=\"true\">\n""        <key column=\"dept_id\"/>\n""        <one-to-many class=\"Employee\"/>\n""        <filter name=\"effectiveDate\"\n""                condition=\":asOfDate BETWEEN eff_start_dt and eff_end_dt\"/"">\n""    </set>\n""</class>]]>"msgstr ""#. Tag: para#: filters.xml:95#, no-c-formatmsgid """Then, in order to ensure that you always get back currently effective ""records, simply enable the filter on the session prior to retrieving ""employee data:"msgstr """定义好后,如果想要保证取回的都是目前处于生效期的记录,只需在获取雇员数据的操""作之前先开启过滤器即可:"#. Tag: programlisting#: filters.xml:100#, no-c-formatmsgid """<![CDATA[Session session = ...;\n""session.enableFilter(\"effectiveDate\").setParameter(\"asOfDate\", new Date""());\n""List results = session.createQuery(\"from Employee as e where e.salary > :""targetSalary\")\n""         .setLong(\"targetSalary\", new Long(1000000))\n""         .list();\n""]]>"msgstr ""#. Tag: para#: filters.xml:102#, no-c-formatmsgid """In the HQL above, even though we only explicitly mentioned a salary ""constraint on the results, because of the enabled filter the query will ""return only currently active employees who have a salary greater than a ""million dollars."msgstr """在上面的HQL中,虽然我们仅仅显式的使用了一个薪水条件,但因为启用了过滤器,查询""将仅返回那些目前雇用 关系处于生效期的,并且薪水高于一百万美刀的雇员的数据。"#. Tag: para#: filters.xml:108#, no-c-formatmsgid """Note: if you plan on using filters with outer joining (either through HQL or ""load fetching) be careful of the direction of the condition expression. Its ""safest to set this up for left outer joining; in general, place the ""parameter first followed by the column name(s) after the operator."msgstr """注意:如果你打算在使用外连接(或者通过HQL或load fetching)的同时使用过滤器,""要注意条件表达式的方向(左还是右)。 最安全的方式是使用左外连接(left outer ""joining)。并且通常来说,先写参数, 然后是操作符,最后写数据库字段名。"#. Tag: para#: filters.xml:115#, no-c-formatmsgid """After being defined a filter might be attached to multiple entities and/or ""collections each with its own condition. That can be tedious when the ""conditions are the same each time. Thus <literal>&lt;filter-def/&gt;</""literal> allows defining a default condition, either as an attribute or ""CDATA:"msgstr """在Filter定义之后,它可能被附加到多个实体和/或集合类,每个都有自己的条件。假若这""些条件都是一样的,每次都要定义就显得很繁琐。因此,<literal>&lt;filter-def/""&gt;</literal>被用来定义一个默认条件,它可能作为属性或者CDATA出现:"#. Tag: programlisting#: filters.xml:122#, no-c-formatmsgid """<![CDATA[<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</filter-""def>\n""<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>]]>"msgstr ""#. Tag: para#: filters.xml:124#, no-c-formatmsgid """This default condition will then be used whenever the filter is attached to ""something without specifying a condition. Note that this means you can give ""a specific condition as part of the attachment of the filter which overrides ""the default condition in that particular case."msgstr """当这个filter被附加到任何目的地,而又没有指明条件时,这个条件就会被使用。注""意,换句话说,你可以通过给filter附加特别的条件来重载默认条件。"

⌨️ 快捷键说明

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