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

📄 basic_mapping.pot

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 POT
📖 第 1 页 / 共 5 页
字号:
#, no-c-formatmsgid "There is an alternative <literal>&lt;composite-id&gt;</literal> declaration to allow access to legacy data with composite keys. We strongly discourage its use for anything else."msgstr ""#. Tag: title#: basic_mapping.xml:556#, no-c-formatmsgid "Generator"msgstr ""#. Tag: para#: basic_mapping.xml:558#, no-c-formatmsgid "The optional <literal>&lt;generator&gt;</literal> child element names a Java class used to generate unique identifiers for instances of the persistent class. If any parameters are required to configure or initialize the generator instance, they are passed using the <literal>&lt;param&gt;</literal> element."msgstr ""#. Tag: programlisting#: basic_mapping.xml:565#, no-c-formatmsgid ""      "<![CDATA[<id name=\"id\" type=\"long\" column=\"cat_id\">\n"      "        <generator class=\"org.hibernate.id.TableHiLoGenerator\">\n"      "                <param name=\"table\">uid_table</param>\n"      "                <param name=\"column\">next_hi_value_column</param>\n"      "        </generator>\n"      "</id>]]>"msgstr ""#. Tag: para#: basic_mapping.xml:567#, no-c-formatmsgid "All generators implement the interface <literal>org.hibernate.id.IdentifierGenerator</literal>. This is a very simple interface; some applications may choose to provide their own specialized implementations. However, Hibernate provides a range of built-in implementations. There are shortcut names for the built-in generators:"msgstr ""#. Tag: literal#: basic_mapping.xml:575#, no-c-formatmsgid "increment"msgstr ""#. Tag: para#: basic_mapping.xml:577#, no-c-formatmsgid "generates identifiers of type <literal>long</literal>, <literal>short</literal> or <literal>int</literal> that are unique only when no other process is inserting data into the same table. <emphasis>Do not use in a cluster.</emphasis>"msgstr ""#. Tag: literal#: basic_mapping.xml:586#, no-c-formatmsgid "identity"msgstr ""#. Tag: para#: basic_mapping.xml:588#, no-c-formatmsgid "supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The returned identifier is of type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>."msgstr ""#. Tag: literal#: basic_mapping.xml:596#, no-c-formatmsgid "sequence"msgstr ""#. Tag: para#: basic_mapping.xml:598#, no-c-formatmsgid "uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The returned identifier is of type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>"msgstr ""#. Tag: literal#: basic_mapping.xml:606#, no-c-formatmsgid "hilo"msgstr ""#. Tag: para#: basic_mapping.xml:608#, no-c-formatmsgid "uses a hi/lo algorithm to efficiently generate identifiers of type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>, given a table and column (by default <literal>hibernate_unique_key</literal> and <literal>next_hi</literal> respectively) as a source of hi values. The hi/lo algorithm generates identifiers that are unique only for a particular database."msgstr ""#. Tag: literal#: basic_mapping.xml:618#, no-c-formatmsgid "seqhilo"msgstr ""#. Tag: para#: basic_mapping.xml:620#, no-c-formatmsgid "uses a hi/lo algorithm to efficiently generate identifiers of type <literal>long</literal>, <literal>short</literal> or <literal>int</literal>, given a named database sequence."msgstr ""#. Tag: literal#: basic_mapping.xml:628#, no-c-formatmsgid "uuid"msgstr ""#. Tag: para#: basic_mapping.xml:630#, no-c-formatmsgid "uses a 128-bit UUID algorithm to generate identifiers of type string, unique within a network (the IP address is used). The UUID is encoded as a string of hexadecimal digits of length 32."msgstr ""#. Tag: literal#: basic_mapping.xml:638#, no-c-formatmsgid "guid"msgstr ""#. Tag: para#: basic_mapping.xml:640#, no-c-formatmsgid "uses a database-generated GUID string on MS SQL Server and MySQL."msgstr ""#. Tag: literal#: basic_mapping.xml:646#, no-c-formatmsgid "native"msgstr ""#. Tag: para#: basic_mapping.xml:648#, no-c-formatmsgid "picks <literal>identity</literal>, <literal>sequence</literal> or <literal>hilo</literal> depending upon the capabilities of the underlying database."msgstr ""#. Tag: literal#: basic_mapping.xml:656#, no-c-formatmsgid "assigned"msgstr ""#. Tag: para#: basic_mapping.xml:658#, no-c-formatmsgid "lets the application to assign an identifier to the object before <literal>save()</literal> is called. This is the default strategy if no <literal>&lt;generator&gt;</literal> element is specified."msgstr ""#. Tag: literal#: basic_mapping.xml:666#, no-c-formatmsgid "select"msgstr ""#. Tag: para#: basic_mapping.xml:668#, no-c-formatmsgid "retrieves a primary key assigned by a database trigger by selecting the row by some unique key and retrieving the primary key value."msgstr ""#. Tag: literal#: basic_mapping.xml:675#, no-c-formatmsgid "foreign"msgstr ""#. Tag: para#: basic_mapping.xml:677#, no-c-formatmsgid "uses the identifier of another associated object. Usually used in conjunction with a <literal>&lt;one-to-one&gt;</literal> primary key association."msgstr ""#. Tag: literal#: basic_mapping.xml:684#, no-c-formatmsgid "sequence-identity"msgstr ""#. Tag: para#: basic_mapping.xml:686#, no-c-formatmsgid "a specialized sequence generation strategy which utilizes a database sequence for the actual value generation, but combines this with JDBC3 getGeneratedKeys to actually return the generated identifier value as part of the insert statement execution. This strategy is only known to be supported on Oracle 10g drivers targetted for JDK 1.4. Note comments on these insert statements are disabled due to a bug in the Oracle drivers."msgstr ""#. Tag: title#: basic_mapping.xml:703#, no-c-formatmsgid "Hi/lo algorithm"msgstr ""#. Tag: para#: basic_mapping.xml:704#, no-c-formatmsgid "The <literal>hilo</literal> and <literal>seqhilo</literal> generators provide two alternate implementations of the hi/lo algorithm, a favorite approach to identifier generation. The first implementation requires a \"special\" database table to hold the next available \"hi\" value. The second uses an Oracle-style sequence (where supported)."msgstr ""#. Tag: programlisting#: basic_mapping.xml:711#, no-c-formatmsgid ""      "<![CDATA[<id name=\"id\" type=\"long\" column=\"cat_id\">\n"      "        <generator class=\"hilo\">\n"      "                <param name=\"table\">hi_value</param>\n"      "                <param name=\"column\">next_value</param>\n"      "                <param name=\"max_lo\">100</param>\n"      "        </generator>\n"      "</id>]]>"msgstr ""#. Tag: programlisting#: basic_mapping.xml:713#, no-c-formatmsgid ""      "<![CDATA[<id name=\"id\" type=\"long\" column=\"cat_id\">\n"      "        <generator class=\"seqhilo\">\n"      "                <param name=\"sequence\">hi_value</param>\n"      "                <param name=\"max_lo\">100</param>\n"      "        </generator>\n"      "</id>]]>"msgstr ""#. Tag: para#: basic_mapping.xml:715#, no-c-formatmsgid "Unfortunately, you can't use <literal>hilo</literal> when supplying your own <literal>Connection</literal> to Hibernate. When Hibernate is using an application server datasource to obtain connections enlisted with JTA, you must properly configure the <literal>hibernate.transaction.manager_lookup_class</literal>."msgstr ""#. Tag: title#: basic_mapping.xml:724#, no-c-formatmsgid "UUID algorithm"msgstr ""#. Tag: para#: basic_mapping.xml:725#, no-c-formatmsgid "The UUID contains: IP address, startup time of the JVM (accurate to a quarter second), system time and a counter value (unique within the JVM). It's not possible to obtain a MAC address or memory address from Java code, so this is the best we can do without using JNI."msgstr ""#. Tag: title#: basic_mapping.xml:734#, no-c-formatmsgid "Identity columns and sequences"msgstr ""#. Tag: para#: basic_mapping.xml:735#, no-c-formatmsgid "For databases which support identity columns (DB2, MySQL, Sybase, MS SQL), you may use <literal>identity</literal> key generation. For databases that support sequences (DB2, Oracle, PostgreSQL, Interbase, McKoi, SAP DB) you may use <literal>sequence</literal> style key generation. Both these strategies require two SQL queries to insert a new object."msgstr ""#. Tag: programlisting#: basic_mapping.xml:743#, no-c-formatmsgid ""      "<![CDATA[<id name=\"id\" type=\"long\" column=\"person_id\">\n"      "        <generator class=\"sequence\">\n"      "                <param name=\"sequence\">person_id_sequence</param>\n"      "        </generator>\n"      "</id>]]>"msgstr ""#. Tag: programlisting#: basic_mapping.xml:745#, no-c-formatmsgid ""      "<![CDATA[<id name=\"id\" type=\"long\" column=\"person_id\" unsaved-value=\"0\">\n"      "        <generator class=\"identity\"/>\n"      "</id>]]>"msgstr ""#. Tag: para#: basic_mapping.xml:747#, no-c-formatmsgid "For cross-platform development, the <literal>native</literal> strategy will choose from the <literal>identity</literal>, <literal>sequence</literal> and <literal>hilo</literal> strategies, dependant upon the capabilities of the underlying database."msgstr ""#. Tag: title#: basic_mapping.xml:756#, no-c-formatmsgid "Assigned identifiers"msgstr ""#. Tag: para#: basic_mapping.xml:757#, no-c-formatmsgid "If you want the application to assign identifiers (as opposed to having Hibernate generate them), you may use the <literal>assigned</literal> generator. This special generator will use the identifier value already assigned to the object's identifier property. This generator is used when the primary key is a natural key instead of a surrogate key. This is the default behavior if you do no specify a <literal>&lt;generator&gt;</literal> element."msgstr ""#. Tag: para#: basic_mapping.xml:766#, no-c-formatmsgid "Choosing the <literal>assigned</literal> generator makes Hibernate use <literal>unsaved-value=\"undefined\"</literal>, forcing Hibernate to go to the database to determine if an instance is transient or detached, unless there is a version or timestamp property, or you define <literal>Interceptor.isUnsaved()</literal>."msgstr ""#. Tag: title#: basic_mapping.xml:776#, no-c-formatmsgid "Primary keys assigned by triggers"msgstr ""#. Tag: para#: basic_mapping.xml:777#, no-c-formatmsgid "For legacy schemas only (Hibernate does not generate DDL with triggers)."msgstr ""#. Tag: programlisting#: basic_mapping.xml:781#, no-c-formatmsgid ""      "<![CDATA[<id name=\"id\" type=\"long\" column=\"person_id\">\n"      "        <generator class=\"select\">\n"      "                <param name=\"key\">socialSecurityNumber</param>\n"      "        </generator>\n"      "</id>]]>"

⌨️ 快捷键说明

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