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

📄 batch.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 2 页
字号:
#. Tag: para#: batch.xml:146#, no-c-formatmsgid """The pseudo-syntax for <literal>UPDATE</literal> and <literal>DELETE</""literal> statements is: <literal>( UPDATE | DELETE ) FROM? EntityName (WHERE ""where_conditions)?</literal>. Some points to note:"msgstr """<literal>UPDATE</literal> 和 <literal>DELETE</literal>语句的语法为: ""<literal>( UPDATE | DELETE ) FROM? EntityName (WHERE where_conditions)?</""literal> 有几点说明:"#. Tag: para#: batch.xml:154#, no-c-formatmsgid "In the from-clause, the FROM keyword is optional"msgstr "在FROM子句(from-clause)中,FROM关键字是可选的"#. Tag: para#: batch.xml:159#, no-c-formatmsgid """There can only be a single entity named in the from-clause; it can ""optionally be aliased. If the entity name is aliased, then any property ""references must be qualified using that alias; if the entity name is not ""aliased, then it is illegal for any property references to be qualified."msgstr """在FROM子句(from-clause)中只能有一个实体名,它可以是别名。如果实体名是别名,""那么任何被引用的属性都必须加上此别名的前缀;如果不是别名,那么任何有前缀的属""性引用都是非法的。"#. Tag: para#: batch.xml:167#, fuzzy, no-c-formatmsgid """No <link linkend=\"queryhql-joins-forms\">joins</link> (either implicit or ""explicit) can be specified in a bulk HQL query. Sub-queries may be used in ""the where-clause; the subqueries, themselves, may contain joins."msgstr """不能在大批量HQL语句中使用<xref linkend=\"queryhql-joins-forms\">连接(join)</""xref>(显式或者隐式的都不行)。不过在WHERE子句中可以使用子查询。可以在where子""句中使用子查询,子查询本身可以包含join。"#. Tag: para#: batch.xml:174#, no-c-formatmsgid "The where-clause is also optional."msgstr "整个WHERE子句是可选的。"#. Tag: para#: batch.xml:180#, no-c-formatmsgid """As an example, to execute an HQL <literal>UPDATE</literal>, use the ""<literal>Query.executeUpdate()</literal> method (the method is named for ""those familiar with JDBC's <literal>PreparedStatement.executeUpdate()</""literal>):"msgstr """举个例子,使用<literal>Query.executeUpdate()</literal>方法执行一个HQL ""<literal>UPDATE</literal>语句(: (方法命名是来源于JDBC's ""<literal>PreparedStatement.executeUpdate()</literal>):"#. Tag: programlisting#: batch.xml:186#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""\n""String hqlUpdate = \"update Customer c set c.name = :newName where c.name = :""oldName\";\n""// or String hqlUpdate = \"update Customer set name = :newName where name = :""oldName\";\n""int updatedEntities = s.createQuery( hqlUpdate )\n""        .setString( \"newName\", newName )\n""        .setString( \"oldName\", oldName )\n""        .executeUpdate();\n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: para#: batch.xml:188#, fuzzy, no-c-formatmsgid """HQL <literal>UPDATE</literal> statements, by default do not effect the <link ""linkend=\"mapping-declaration-version\">version</link> or the <link linkend=""\"mapping-declaration-timestamp\">timestamp</link> property values for the ""affected entities; this is in keeping with the EJB3 specification. However, ""you can force Hibernate to properly reset the <literal>version</literal> or ""<literal>timestamp</literal> property values through the use of a ""<literal>versioned update</literal>. This is achieved by adding the ""<literal>VERSIONED</literal> keyword after the <literal>UPDATE</literal> ""keyword."msgstr """HQL <literal>UPDATE</literal>语句,默认不会影响更新实体的<xref linkend=""\"mapping-declaration-version\">version</xref>或者<xref linkend=\"mapping-""declaration-timestamp\">timestamp</xref>属性值。这和EJB3规范是一致的。但是,""通过使用<literal>versioned update</literal>,你可以强制Hibernate正确的重置""<literal>version</literal>或者<literal>timestamp</literal>属性值。这通过在""<literal>UPDATE</literal>关键字后面增加<literal>VERSIONED</literal>关键字来实""现的。"#. Tag: programlisting#: batch.xml:198#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""String hqlVersionedUpdate = \"update versioned Customer set name = :newName ""where name = :oldName\";\n""int updatedEntities = s.createQuery( hqlUpdate )\n""        .setString( \"newName\", newName )\n""        .setString( \"oldName\", oldName )\n""        .executeUpdate();\n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: para#: batch.xml:200#, no-c-formatmsgid """Note that custom version types (<literal>org.hibernate.usertype.""UserVersionType</literal>) are not allowed in conjunction with a ""<literal>update versioned</literal> statement."msgstr """注意,自定义的版本类型(<literal>org.hibernate.usertype.UserVersionType</""literal>)不允许和<literal>update versioned</literal>语句联用。"#. Tag: para#: batch.xml:205#, no-c-formatmsgid """To execute an HQL <literal>DELETE</literal>, use the same <literal>Query.""executeUpdate()</literal> method:"msgstr """执行一个HQL <literal>DELETE</literal>,同样使用 <literal>Query.executeUpdate""()</literal> 方法:"#. Tag: programlisting#: batch.xml:210#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""\n""String hqlDelete = \"delete Customer c where c.name = :oldName\";\n""// or String hqlDelete = \"delete Customer where name = :oldName\";\n""int deletedEntities = s.createQuery( hqlDelete )\n""        .setString( \"oldName\", oldName )\n""        .executeUpdate();\n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: para#: batch.xml:212#, no-c-formatmsgid """The <literal>int</literal> value returned by the <literal>Query.executeUpdate""()</literal> method indicate the number of entities effected by the ""operation. Consider this may or may not correlate to the number of rows ""effected in the database. An HQL bulk operation might result in multiple ""actual SQL statements being executed, for joined-subclass, for example. The ""returned number indicates the number of actual entities affected by the ""statement. Going back to the example of joined-subclass, a delete against ""one of the subclasses may actually result in deletes against not just the ""table to which that subclass is mapped, but also the \"root\" table and ""potentially joined-subclass tables further down the inheritence hierarchy."msgstr """由<literal>Query.executeUpdate()</literal>方法返回的<literal>整型</literal>值""表明了受此操作影响的记录数量。 注意这个数值可能与数据库中被(最后一条SQL语""句)影响了的“行”数有关,也可能没有。一个大批量HQL操作可能导致多条实际的SQL语""句被执行, 举个例子,对joined-subclass映射方式的类进行的此类操作。这个返回值""代表了实际被语句影响了的记录数量。在那个joined-subclass的例子中, 对一个子类""的删除实际上可能不仅仅会删除子类映射到的表而且会影响“根”表,还有可能影响与之""有继承关系的joined-subclass映射方式的子类的表。"#. Tag: para#: batch.xml:223#, no-c-formatmsgid """The pseudo-syntax for <literal>INSERT</literal> statements is: ""<literal>INSERT INTO EntityName properties_list select_statement</literal>. ""Some points to note:"msgstr """<literal>INSERT</literal>语句的伪码是: <literal>INSERT INTO EntityName ""properties_list select_statement</literal>. 要注意的是:"#. Tag: para#: batch.xml:231#, no-c-formatmsgid """Only the INSERT INTO ... SELECT ... form is supported; not the INSERT ""INTO ... VALUES ... form."msgstr """只支持INSERT INTO ... SELECT ...形式,不支持INSERT INTO ... VALUES ...形式."#. Tag: para#: batch.xml:234#, no-c-formatmsgid """The properties_list is analogous to the <literal>column speficiation</""literal> in the SQL <literal>INSERT</literal> statement. For entities ""involved in mapped inheritence, only properties directly defined on that ""given class-level can be used in the properties_list. Superclass properties ""are not allowed; and subclass properties do not make sense. In other words, ""<literal>INSERT</literal> statements are inherently non-polymorphic."msgstr """properties_list和SQL <literal>INSERT</literal>语句中的<literal>字段定义""(column speficiation)</literal>类似。对参与继承树映射的实体而言,只有直接定义""在给定的类级别的属性才能直接在properties_list中使用。超类的属性不被支持;子类""的属性无意义。换句话说,<literal>INSERT</literal>天生不支持多态。"#. Tag: para#: batch.xml:244#, no-c-formatmsgid """select_statement can be any valid HQL select query, with the caveat that the ""return types must match the types expected by the insert. Currently, this is ""checked during query compilation rather than allowing the check to relegate ""to the database. Note however that this might cause problems between ""Hibernate <literal>Type</literal>s which are <emphasis>equivalent</emphasis> ""as opposed to <emphasis>equal</emphasis>. This might cause issues with ""mismatches between a property defined as a <literal>org.hibernate.type.""DateType</literal> and a property defined as a <literal>org.hibernate.type.""TimestampType</literal>, even though the database might not make a ""distinction or might be able to handle the conversion."msgstr """select_statement可以是任何合法的HQL选择查询,不过要保证返回类型必须和要插入的""类型完全匹配。目前,这一检查是在查询编译的时候进行的,而不是把它交给数据库。""注意,在Hibernate<literal>Type</literal>间如果只是<emphasis>等价""(equivalent)</emphasis>而非<emphasis>相等(equal)</emphasis>,会导致问题。定""义为<literal>org.hibernate.type.DateType</literal>和<literal>org.hibernate.""type.TimestampType</literal>的两个属性可能会产生类型不匹配错误,虽然数据库级""可能不加区分或者可以处理这种转换。"#. Tag: para#: batch.xml:256#, no-c-formatmsgid """For the id property, the insert statement gives you two options. You can ""either explicitly specify the id property in the properties_list (in which ""case its value is taken from the corresponding select expression) or omit it ""from the properties_list (in which case a generated value is used). This ""later option is only available when using id generators that operate in the ""database; attempting to use this option with any \"in memory\" type ""generators will cause an exception during parsing. Note that for the ""purposes of this discussion, in-database generators are considered to be ""<literal>org.hibernate.id.SequenceGenerator</literal> (and its subclasses) ""and any implementors of <literal>org.hibernate.id.""PostInsertIdentifierGenerator</literal>. The most notable exception here is ""<literal>org.hibernate.id.TableHiLoGenerator</literal>, which cannot be used ""because it does not expose a selectable way to get its values."msgstr """对id属性来说,insert语句给你两个选择。你可以明确地在properties_list表中指定id""属性(这样它的值是从对应的select表达式中获得),或者在properties_list中省略它""(此时使用生成指)。后一种选择只有当使用在数据库中生成值的id产生器时才能使""用;如果是“内存”中计算的类型生成器,在解析时会抛出一个异常。注意,为了说明这""一问题,数据库产生值的生成器是<literal>org.hibernate.id.SequenceGenerator</""literal>(和它的子类),以及任何<literal>org.hibernate.id.""PostInsertIdentifierGenerator</literal>接口的实现。这儿最值得注意的意外是""<literal>org.hibernate.id.TableHiLoGenerator</literal>,它不能在此使用,因为""它没有得到其值的途径。"#. Tag: para#: batch.xml:271#, no-c-formatmsgid """For properties mapped as either <literal>version</literal> or ""<literal>timestamp</literal>, the insert statement gives you two options. ""You can either specify the property in the properties_list (in which case ""its value is taken from the corresponding select expressions) or omit it ""from the properties_list (in which case the <literal>seed value</literal> ""defined by the <literal>org.hibernate.type.VersionType</literal> is used)."msgstr """对映射为<literal>version</literal> 或 <literal>timestamp</literal>的属性来""说,insert语句也给你两个选择,你可以在properties_list表中指定(此时其值从对应""的select表达式中获得),或者在properties_list中省略它(此时,使用在""<literal>org.hibernate.type.VersionType</literal> 中定义的<literal>seed value""(种子值)</literal>)。"#. Tag: para#: batch.xml:281#, no-c-formatmsgid "An example HQL <literal>INSERT</literal> statement execution:"msgstr "执行HQL <literal>INSERT</literal>语句的例子如下:"#. Tag: programlisting#: batch.xml:285#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""\n""String hqlInsert = \"insert into DelinquentAccount (id, name) select c.id, c.""name from Customer c where ...\";\n""int createdEntities = s.createQuery( hqlInsert )\n""        .executeUpdate();\n""tx.commit();\n""session.close();]]>"msgstr ""

⌨️ 快捷键说明

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