HHH-3270 : documentation license
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14653 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
2c858bd964
commit
3eaf44c74c
|
@ -1,256 +1,322 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:28-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: architecture.xml:32(None)
|
||||
msgid "@@image: '../images/overview.svg'; md5=2d9211eace02ecef615f7dd42beec14c"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: architecture.xml:35(None)
|
||||
msgid "@@image: '../images/overview.png'; md5=a2b5f0f7dc75d9773305d4d824880e8c"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: architecture.xml:54(None)
|
||||
msgid "@@image: '../images/lite.svg'; md5=2178e70b3b165736d33b085dcad93699"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: architecture.xml:57(None)
|
||||
msgid "@@image: '../images/lite.png'; md5=7dd864188937e2dfef42a706235f74c3"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: architecture.xml:68(None)
|
||||
msgid "@@image: '../images/full_cream.svg'; md5=4ef192f03e90e451e5dcb287d2709687"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: architecture.xml:71(None)
|
||||
msgid "@@image: '../images/full_cream.png'; md5=c3ee197b49364a876bc5867d5c2c6db7"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:21(title)
|
||||
#. Tag: title
|
||||
#: architecture.xml:30
|
||||
#, no-c-format
|
||||
msgid "Architecture"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:24(title)
|
||||
#. Tag: title
|
||||
#: architecture.xml:33
|
||||
#, no-c-format
|
||||
msgid "Overview"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:26(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:35
|
||||
#, no-c-format
|
||||
msgid "A (very) high-level view of the Hibernate architecture:"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:39(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:48
|
||||
#, no-c-format
|
||||
msgid "This diagram shows Hibernate using the database and configuration data to provide persistence services (and persistent objects) to the application."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:44(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:53
|
||||
#, no-c-format
|
||||
msgid "We would like to show a more detailed view of the runtime architecture. Unfortunately, Hibernate is flexible and supports several approaches. We will show the two extremes. The \"lite\" architecture has the application provide its own JDBC connections and manage its own transactions. This approach uses a minimal subset of Hibernate's APIs:"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:61(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:70
|
||||
#, no-c-format
|
||||
msgid "The \"full cream\" architecture abstracts the application away from the underlying JDBC/JTA APIs and lets Hibernate take care of the details."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:80(term)
|
||||
#. Tag: para
|
||||
#: architecture.xml:84
|
||||
#, no-c-format
|
||||
msgid "Heres some definitions of the objects in the diagrams:"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: term
|
||||
#: architecture.xml:89
|
||||
#, no-c-format
|
||||
msgid "SessionFactory (<literal>org.hibernate.SessionFactory</literal>)"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:82(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:91
|
||||
#, no-c-format
|
||||
msgid "A threadsafe (immutable) cache of compiled mappings for a single database. A factory for <literal>Session</literal> and a client of <literal>ConnectionProvider</literal>. Might hold an optional (second-level) cache of data that is reusable between transactions, at a process- or cluster-level."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:92(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:101
|
||||
#, no-c-format
|
||||
msgid "Session (<literal>org.hibernate.Session</literal>)"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:94(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:103
|
||||
#, no-c-format
|
||||
msgid "A single-threaded, short-lived object representing a conversation between the application and the persistent store. Wraps a JDBC connection. Factory for <literal>Transaction</literal>. Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:104(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:113
|
||||
#, no-c-format
|
||||
msgid "Persistent objects and collections"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:106(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:115
|
||||
#, no-c-format
|
||||
msgid "Short-lived, single threaded objects containing persistent state and business function. These might be ordinary JavaBeans/POJOs, the only special thing about them is that they are currently associated with (exactly one) <literal>Session</literal>. As soon as the <literal>Session</literal> is closed, they will be detached and free to use in any application layer (e.g. directly as data transfer objects to and from presentation)."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:117(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:126
|
||||
#, no-c-format
|
||||
msgid "Transient and detached objects and collections"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:119(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:128
|
||||
#, no-c-format
|
||||
msgid "Instances of persistent classes that are not currently associated with a <literal>Session</literal>. They may have been instantiated by the application and not (yet) persisted or they may have been instantiated by a closed <literal>Session</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:128(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:137
|
||||
#, no-c-format
|
||||
msgid "Transaction (<literal>org.hibernate.Transaction</literal>)"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:130(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:139
|
||||
#, no-c-format
|
||||
msgid "(Optional) A single-threaded, short-lived object used by the application to specify atomic units of work. Abstracts application from underlying JDBC, JTA or CORBA transaction. A <literal>Session</literal> might span several <literal>Transaction</literal>s in some cases. However, transaction demarcation, either using the underlying API or <literal>Transaction</literal>, is never optional!"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:141(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:150
|
||||
#, no-c-format
|
||||
msgid "ConnectionProvider (<literal>org.hibernate.connection.ConnectionProvider</literal>)"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:143(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:152
|
||||
#, no-c-format
|
||||
msgid "(Optional) A factory for (and pool of) JDBC connections. Abstracts application from underlying <literal>Datasource</literal> or <literal>DriverManager</literal>. Not exposed to application, but can be extended/implemented by the developer."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:151(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:160
|
||||
#, no-c-format
|
||||
msgid "TransactionFactory (<literal>org.hibernate.TransactionFactory</literal>)"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:153(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:162
|
||||
#, no-c-format
|
||||
msgid "(Optional) A factory for <literal>Transaction</literal> instances. Not exposed to the application, but can be extended/implemented by the developer."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:160(emphasis)
|
||||
#. Tag: emphasis
|
||||
#: architecture.xml:169
|
||||
#, no-c-format
|
||||
msgid "Extension Interfaces"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:162(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:171
|
||||
#, no-c-format
|
||||
msgid "Hibernate offers many optional extension interfaces you can implement to customize the behavior of your persistence layer. See the API documentation for details."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:75(para)
|
||||
msgid "Heres some definitions of the objects in the diagrams: <placeholder-1/>"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:171(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:180
|
||||
#, no-c-format
|
||||
msgid "Given a \"lite\" architecture, the application bypasses the <literal>Transaction</literal>/<literal>TransactionFactory</literal> and/or <literal>ConnectionProvider</literal> APIs to talk to JTA or JDBC directly."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:179(title)
|
||||
#. Tag: title
|
||||
#: architecture.xml:188
|
||||
#, no-c-format
|
||||
msgid "Instance states"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:180(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:189
|
||||
#, no-c-format
|
||||
msgid "An instance of a persistent classes may be in one of three different states, which are defined with respect to a <emphasis>persistence context</emphasis>. The Hibernate <literal>Session</literal> object is the persistence context:"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:188(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:197
|
||||
#, no-c-format
|
||||
msgid "transient"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:190(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:199
|
||||
#, no-c-format
|
||||
msgid "The instance is not, and has never been associated with any persistence context. It has no persistent identity (primary key value)."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:198(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:207
|
||||
#, no-c-format
|
||||
msgid "persistent"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:200(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:209
|
||||
#, no-c-format
|
||||
msgid "The instance is currently associated with a persistence context. It has a persistent identity (primary key value) and, perhaps, a corresponding row in the database. For a particular persistence context, Hibernate <emphasis>guarantees</emphasis> that persistent identity is equivalent to Java identity (in-memory location of the object)."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:212(term)
|
||||
#. Tag: term
|
||||
#: architecture.xml:221
|
||||
#, no-c-format
|
||||
msgid "detached"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:214(para)
|
||||
msgid "The instance was once associated with a persistence context, but that context was closed, or the instance was serialized to another process. It has a persistent identity and, perhaps, a corrsponding row in the database. For detached instances, Hibernate makes no guarantees about the relationship between persistent identity and Java identity."
|
||||
#. Tag: para
|
||||
#: architecture.xml:223
|
||||
#, no-c-format
|
||||
msgid "The instance was once associated with a persistence context, but that context was closed, or the instance was serialized to another process. It has a persistent identity and, perhaps, a corresponding row in the database. For detached instances, Hibernate makes no guarantees about the relationship between persistent identity and Java identity."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:229(title)
|
||||
#. Tag: title
|
||||
#: architecture.xml:238
|
||||
#, no-c-format
|
||||
msgid "JMX Integration"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:231(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:240
|
||||
#, no-c-format
|
||||
msgid "JMX is the J2EE standard for management of Java components. Hibernate may be managed via a JMX standard service. We provide an MBean implementation in the distribution, <literal>org.hibernate.jmx.HibernateService</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:237(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:246
|
||||
#, no-c-format
|
||||
msgid "For an example how to deploy Hibernate as a JMX service on the JBoss Application Server, please see the JBoss User Guide. On JBoss AS, you also get these benefits if you deploy using JMX:"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:245(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:254
|
||||
#, no-c-format
|
||||
msgid "<emphasis>Session Management:</emphasis> The Hibernate <literal>Session</literal>'s life cycle can be automatically bound to the scope of a JTA transaction. This means you no longer have to manually open and close the <literal>Session</literal>, this becomes the job of a JBoss EJB interceptor. You also don't have to worry about transaction demarcation in your code anymore (unless you'd like to write a portable persistence layer of course, use the optional Hibernate <literal>Transaction</literal> API for this). You call the <literal>HibernateContext</literal> to access a <literal>Session</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:257(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:266
|
||||
#, no-c-format
|
||||
msgid "<emphasis>HAR deployment:</emphasis> Usually you deploy the Hibernate JMX service using a JBoss service deployment descriptor (in an EAR and/or SAR file), it supports all the usual configuration options of a Hibernate <literal>SessionFactory</literal>. However, you still have to name all your mapping files in the deployment descriptor. If you decide to use the optional HAR deployment, JBoss will automatically detect all mapping files in your HAR file."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:268(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:277
|
||||
#, no-c-format
|
||||
msgid "Consult the JBoss AS user guide for more information about these options."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:272(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:281
|
||||
#, no-c-format
|
||||
msgid "Another feature available as a JMX service are runtime Hibernate statistics. See <xref linkend=\"configuration-optional-statistics\"/>."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:279(title)
|
||||
#. Tag: title
|
||||
#: architecture.xml:288
|
||||
#, no-c-format
|
||||
msgid "JCA Support"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:280(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:289
|
||||
#, no-c-format
|
||||
msgid "Hibernate may also be configured as a JCA connector. Please see the website for more details. Please note that Hibernate JCA support is still considered experimental."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:287(title)
|
||||
#. Tag: title
|
||||
#: architecture.xml:296
|
||||
#, no-c-format
|
||||
msgid "Contextual Sessions"
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:288(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:297
|
||||
#, no-c-format
|
||||
msgid "Most applications using Hibernate need some form of \"contextual\" sessions, where a given session is in effect throughout the scope of a given context. However, across applications the definition of what constitutes a context is typically different; and different contexts define different scopes to the notion of current. Applications using Hibernate prior to version 3.0 tended to utilize either home-grown <literal>ThreadLocal</literal>-based contextual sessions, helper classes such as <literal>HibernateUtil</literal>, or utilized third-party frameworks (such as Spring or Pico) which provided proxy/interception-based contextual sessions."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:297(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:306
|
||||
#, no-c-format
|
||||
msgid "Starting with version 3.0.1, Hibernate added the <literal>SessionFactory.getCurrentSession()</literal> method. Initially, this assumed usage of <literal>JTA</literal> transactions, where the <literal>JTA</literal> transaction defined both the scope and context of a current session. The Hibernate team maintains that, given the maturity of the numerous stand-alone <literal>JTA TransactionManager</literal> implementations out there, most (if not all) applications should be using <literal>JTA</literal> transaction management whether or not they are deployed into a <literal>J2EE</literal> container. Based on that, the <literal>JTA</literal>-based contextual sessions is all you should ever need to use."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:307(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:316
|
||||
#, no-c-format
|
||||
msgid "However, as of version 3.1, the processing behind <literal>SessionFactory.getCurrentSession()</literal> is now pluggable. To that end, a new extension interface (<literal>org.hibernate.context.CurrentSessionContext</literal>) and a new configuration parameter (<literal>hibernate.current_session_context_class</literal>) have been added to allow pluggability of the scope and context of defining current sessions."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:314(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:323
|
||||
#, no-c-format
|
||||
msgid "See the Javadocs for the <literal>org.hibernate.context.CurrentSessionContext</literal> interface for a detailed discussion of its contract. It defines a single method, <literal>currentSession()</literal>, by which the implementation is responsible for tracking the current contextual session. Out-of-the-box, Hibernate comes with three implementations of this interface."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:324(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:333
|
||||
#, no-c-format
|
||||
msgid "<literal>org.hibernate.context.JTASessionContext</literal> - current sessions are tracked and scoped by a <literal>JTA</literal> transaction. The processing here is exactly the same as in the older JTA-only approach. See the Javadocs for details."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:332(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:341
|
||||
#, no-c-format
|
||||
msgid "<literal>org.hibernate.context.ThreadLocalSessionContext</literal> - current sessions are tracked by thread of execution. Again, see the Javadocs for details."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:338(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:347
|
||||
#, no-c-format
|
||||
msgid "<literal>org.hibernate.context.ManagedSessionContext</literal> - current sessions are tracked by thread of execution. However, you are responsible to bind and unbind a <literal>Session</literal> instance with static methods on this class, it does never open, flush, or close a <literal>Session</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:347(para)
|
||||
msgid "The first two implementations provide a \"one session - one database transaction\" programming model, also known and used as <emphasis>session-per-request</emphasis>. The beginning and end of a Hibernate session is defined by the duration of a database transaction. If you use programatic transaction demarcation in plain JSE without JTA, you are adviced to use the Hibernate <literal>Transaction</literal> API to hide the underlying transaction system from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you execute in an EJB container that supports CMT, transaction boundaries are defined declaratively and you don't need any transaction or session demarcation operations in your code. Refer to <xref linkend=\"transactions\"/> for more information and code examples."
|
||||
#. Tag: para
|
||||
#: architecture.xml:356
|
||||
#, no-c-format
|
||||
msgid "The first two implementations provide a \"one session - one database transaction\" programming model, also known and used as <emphasis>session-per-request</emphasis>. The beginning and end of a Hibernate session is defined by the duration of a database transaction. If you use programmatic transaction demarcation in plain JSE without JTA, you are advised to use the Hibernate <literal>Transaction</literal> API to hide the underlying transaction system from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you execute in an EJB container that supports CMT, transaction boundaries are defined declaratively and you don't need any transaction or session demarcation operations in your code. Refer to <xref linkend=\"transactions\"/> for more information and code examples."
|
||||
msgstr ""
|
||||
|
||||
#: architecture.xml:359(para)
|
||||
#. Tag: para
|
||||
#: architecture.xml:368
|
||||
#, no-c-format
|
||||
msgid "The <literal>hibernate.current_session_context_class</literal> configuration parameter defines which <literal>org.hibernate.context.CurrentSessionContext</literal> implementation should be used. Note that for backwards compatibility, if this config param is not set but a <literal>org.hibernate.transaction.TransactionManagerLookup</literal> is configured, Hibernate will use the <literal>org.hibernate.context.JTASessionContext</literal>. Typically, the value of this parameter would just name the implementation class to use; for the three out-of-the-box implementations, however, there are three corresponding short names, \"jta\", \"thread\", and \"managed\"."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: architecture.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,160 +1,738 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:28-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: association_mapping.xml:6(title)
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:30
|
||||
#, no-c-format
|
||||
msgid "Association Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:9(title)
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:33
|
||||
#, no-c-format
|
||||
msgid "Introduction"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:11(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:35
|
||||
#, no-c-format
|
||||
msgid "Association mappings are the often most difficult thing to get right. In this section we'll go through the canonical cases one by one, starting with unidirectional mappings, and then considering the bidirectional cases. We'll use <literal>Person</literal> and <literal>Address</literal> in all the examples."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:19(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:43
|
||||
#, no-c-format
|
||||
msgid "We'll classify associations by whether or not they map to an intervening join table, and by multiplicity."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:24(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:48
|
||||
#, no-c-format
|
||||
msgid "Nullable foreign keys are not considered good practice in traditional data modelling, so all our examples use not null foreign keys. This is not a requirement of Hibernate, and the mappings will all work if you drop the nullability constraints."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:34(title)
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:58
|
||||
#, no-c-format
|
||||
msgid "Unidirectional associations"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:37(title) association_mapping.xml:195(title)
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:61 association_mapping.xml:132
|
||||
#, no-c-format
|
||||
msgid "many to one"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:39(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:63
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional many-to-one association</emphasis> is the most common kind of unidirectional association."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:66(title) association_mapping.xml:229(title) association_mapping.xml:373(title) association_mapping.xml:479(title)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:68
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <many-to-one name=\"address\" \n"
|
||||
" column=\"addressId\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:69 association_mapping.xml:185
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key, addressId bigint not null )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:74 association_mapping.xml:145 association_mapping.xml:209 association_mapping.xml:249
|
||||
#, no-c-format
|
||||
msgid "one to one"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:68(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:76
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional one-to-one association on a foreign key</emphasis> is almost identical. The only difference is the column unique constraint."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:93(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:81
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <many-to-one name=\"address\" \n"
|
||||
" column=\"addressId\" \n"
|
||||
" unique=\"true\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:82 association_mapping.xml:217
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key, addressId bigint not null unique )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:84
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional one-to-one association on a primary key</emphasis> usually uses a special id generator. (Notice that we've reversed the direction of the association in this example.)"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:121(title) association_mapping.xml:161(title)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:90
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"foreign\">\n"
|
||||
" <param name=\"property\">person</param>\n"
|
||||
" </generator>\n"
|
||||
" </id>\n"
|
||||
" <one-to-one name=\"person\" constrained=\"true\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:91 association_mapping.xml:225
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table Address ( personId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:96 association_mapping.xml:118
|
||||
#, no-c-format
|
||||
msgid "one to many"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:123(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:98
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional one-to-many association on a foreign key</emphasis> is a very unusual case, and is not really recommended."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:149(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:103
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"addresses\">\n"
|
||||
" <key column=\"personId\" \n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" <one-to-many class=\"Address\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:104
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table Address ( addressId bigint not null primary key, personId bigint not null )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:106
|
||||
#, no-c-format
|
||||
msgid "We think it's better to use a join table for this kind of association."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:158(title)
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:115
|
||||
#, no-c-format
|
||||
msgid "Unidirectional associations with join tables"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:163(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:120
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional one-to-many association on a join table</emphasis> is much preferred. Notice that by specifying <literal>unique=\"true\"</literal>, we have changed the multiplicity from many-to-many to one-to-many."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:197(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:126
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"addresses\" table=\"PersonAddress\">\n"
|
||||
" <key column=\"personId\"/>\n"
|
||||
" <many-to-many column=\"addressId\"\n"
|
||||
" unique=\"true\"\n"
|
||||
" class=\"Address\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:127
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table PersonAddress ( personId not null, addressId bigint not null primary key )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:134
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional many-to-one association on a join table</emphasis> is quite common when the association is optional."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:231(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:139
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <join table=\"PersonAddress\" \n"
|
||||
" optional=\"true\">\n"
|
||||
" <key column=\"personId\" unique=\"true\"/>\n"
|
||||
" <many-to-one name=\"address\"\n"
|
||||
" column=\"addressId\" \n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" </join>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:140
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table PersonAddress ( personId bigint not null primary key, addressId bigint not null )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:147
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>unidirectional one-to-one association on a join table</emphasis> is extremely unusual, but possible."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:265(title) association_mapping.xml:525(title)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:152
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <join table=\"PersonAddress\" \n"
|
||||
" optional=\"true\">\n"
|
||||
" <key column=\"personId\" \n"
|
||||
" unique=\"true\"/>\n"
|
||||
" <many-to-one name=\"address\"\n"
|
||||
" column=\"addressId\" \n"
|
||||
" not-null=\"true\"\n"
|
||||
" unique=\"true\"/>\n"
|
||||
" </join>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:153 association_mapping.xml:257
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table PersonAddress ( personId bigint not null primary key, addressId bigint not null unique )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:158 association_mapping.xml:262
|
||||
#, no-c-format
|
||||
msgid "many to many"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:267(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:160
|
||||
#, no-c-format
|
||||
msgid "Finally, we have a <emphasis>unidirectional many-to-many association</emphasis>."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:298(title)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:164
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"addresses\" table=\"PersonAddress\">\n"
|
||||
" <key column=\"personId\"/>\n"
|
||||
" <many-to-many column=\"addressId\"\n"
|
||||
" class=\"Address\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:165 association_mapping.xml:270
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table PersonAddress ( personId bigint not null, addressId bigint not null, primary key (personId, addressId) )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:172
|
||||
#, no-c-format
|
||||
msgid "Bidirectional associations"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:301(title) association_mapping.xml:436(title)
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:175 association_mapping.xml:235
|
||||
#, no-c-format
|
||||
msgid "one to many / many to one"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:303(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:177
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>bidirectional many-to-one association</emphasis> is the most common kind of association. (This is the standard parent/child relationship.)"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:333(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:183
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <many-to-one name=\"address\" \n"
|
||||
" column=\"addressId\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"people\" inverse=\"true\">\n"
|
||||
" <key column=\"addressId\"/>\n"
|
||||
" <one-to-many class=\"Person\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:187
|
||||
#, no-c-format
|
||||
msgid "If you use a <literal>List</literal> (or other indexed collection) you need to set the <literal>key</literal> column of the foreign key to <literal>not null</literal>, and let Hibernate manage the association from the collections side to maintain the index of each element (making the other side virtually inverse by setting <literal>update=\"false\"</literal> and <literal>insert=\"false\"</literal>):"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:361(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:195
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\"/>\n"
|
||||
" ...\n"
|
||||
" <many-to-one name=\"address\"\n"
|
||||
" column=\"addressId\"\n"
|
||||
" not-null=\"true\"\n"
|
||||
" insert=\"false\"\n"
|
||||
" update=\"false\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\"/>\n"
|
||||
" ...\n"
|
||||
" <list name=\"people\">\n"
|
||||
" <key column=\"addressId\" not-null=\"true\"/>\n"
|
||||
" <list-index column=\"peopleIdx\"/>\n"
|
||||
" <one-to-many class=\"Person\"/>\n"
|
||||
" </list>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:197
|
||||
#, no-c-format
|
||||
msgid "It is important that you define <literal>not-null=\"true\"</literal> on the <literal><key></literal> element of the collection mapping if the underlying foreign key column is <literal>NOT NULL</literal>. Don't only declare <literal>not-null=\"true\"</literal> on a possible nested <literal><column></literal> element, but on the <literal><key></literal> element."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:375(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:211
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>bidirectional one-to-one association on a foreign key</emphasis> is quite common."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:402(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:216
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <many-to-one name=\"address\" \n"
|
||||
" column=\"addressId\" \n"
|
||||
" unique=\"true\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <one-to-one name=\"person\" \n"
|
||||
" property-ref=\"address\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:219
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>bidirectional one-to-one association on a primary key</emphasis> uses the special id generator."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:433(title)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:224
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <one-to-one name=\"address\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"foreign\">\n"
|
||||
" <param name=\"property\">person</param>\n"
|
||||
" </generator>\n"
|
||||
" </id>\n"
|
||||
" <one-to-one name=\"person\" \n"
|
||||
" constrained=\"true\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:232
|
||||
#, no-c-format
|
||||
msgid "Bidirectional associations with join tables"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:438(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:237
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>bidirectional one-to-many association on a join table</emphasis>. Note that the <literal>inverse=\"true\"</literal> can go on either end of the association, on the collection, or on the join."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:481(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:243
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"addresses\" \n"
|
||||
" table=\"PersonAddress\">\n"
|
||||
" <key column=\"personId\"/>\n"
|
||||
" <many-to-many column=\"addressId\"\n"
|
||||
" unique=\"true\"\n"
|
||||
" class=\"Address\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <join table=\"PersonAddress\" \n"
|
||||
" inverse=\"true\" \n"
|
||||
" optional=\"true\">\n"
|
||||
" <key column=\"addressId\"/>\n"
|
||||
" <many-to-one name=\"person\"\n"
|
||||
" column=\"personId\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" </join>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:244
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"create table Person ( personId bigint not null primary key )\n"
|
||||
"create table PersonAddress ( personId bigint not null, addressId bigint not null primary key )\n"
|
||||
"create table Address ( addressId bigint not null primary key )\n"
|
||||
" ]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:251
|
||||
#, no-c-format
|
||||
msgid "A <emphasis>bidirectional one-to-one association on a join table</emphasis> is extremely unusual, but possible."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:527(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:256
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <join table=\"PersonAddress\" \n"
|
||||
" optional=\"true\">\n"
|
||||
" <key column=\"personId\" \n"
|
||||
" unique=\"true\"/>\n"
|
||||
" <many-to-one name=\"address\"\n"
|
||||
" column=\"addressId\" \n"
|
||||
" not-null=\"true\"\n"
|
||||
" unique=\"true\"/>\n"
|
||||
" </join>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <join table=\"PersonAddress\" \n"
|
||||
" optional=\"true\"\n"
|
||||
" inverse=\"true\">\n"
|
||||
" <key column=\"addressId\" \n"
|
||||
" unique=\"true\"/>\n"
|
||||
" <many-to-one name=\"person\"\n"
|
||||
" column=\"personId\" \n"
|
||||
" not-null=\"true\"\n"
|
||||
" unique=\"true\"/>\n"
|
||||
" </join>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:264
|
||||
#, no-c-format
|
||||
msgid "Finally, we have a <emphasis>bidirectional many-to-many association</emphasis>."
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:564(title)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:268
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"id\" column=\"personId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"addresses\" table=\"PersonAddress\">\n"
|
||||
" <key column=\"personId\"/>\n"
|
||||
" <many-to-many column=\"addressId\"\n"
|
||||
" class=\"Address\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
" <id name=\"id\" column=\"addressId\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <set name=\"people\" inverse=\"true\" table=\"PersonAddress\">\n"
|
||||
" <key column=\"addressId\"/>\n"
|
||||
" <many-to-many column=\"personId\"\n"
|
||||
" class=\"Person\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: association_mapping.xml:277
|
||||
#, no-c-format
|
||||
msgid "More complex association mappings"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:566(para)
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:279
|
||||
#, no-c-format
|
||||
msgid "More complex association joins are <emphasis>extremely</emphasis> rare. Hibernate makes it possible to handle more complex situations using SQL fragments embedded in the mapping document. For example, if a table with historical account information data defines <literal>accountNumber</literal>, <literal>effectiveEndDate</literal> and <literal>effectiveStartDate</literal>columns, mapped as follows:"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:584(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:288
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<properties name=\"currentAccountKey\">\n"
|
||||
" <property name=\"accountNumber\" type=\"string\" not-null=\"true\"/>\n"
|
||||
" <property name=\"currentAccount\" type=\"boolean\">\n"
|
||||
" <formula>case when effectiveEndDate is null then 1 else 0 end</formula>\n"
|
||||
" </property>\n"
|
||||
"</properties>\n"
|
||||
"<property name=\"effectiveEndDate\" type=\"date\"/>\n"
|
||||
"<property name=\"effectiveStateDate\" type=\"date\" not-null=\"true\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:290
|
||||
#, no-c-format
|
||||
msgid "Then we can map an association to the <emphasis>current</emphasis> instance (the one with null <literal>effectiveEndDate</literal>) using:"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:596(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:295
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<many-to-one name=\"currentAccountInfo\" \n"
|
||||
" property-ref=\"currentAccountKey\"\n"
|
||||
" class=\"AccountInfo\">\n"
|
||||
" <column name=\"accountNumber\"/>\n"
|
||||
" <formula>'1'</formula>\n"
|
||||
"</many-to-one>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:297
|
||||
#, no-c-format
|
||||
msgid "In a more complex example, imagine that the association between <literal>Employee</literal> and <literal>Organization</literal> is maintained in an <literal>Employment</literal> table full of historical employment data. Then an association to the employee's <emphasis>most recent</emphasis> employer (the one with the most recent <literal>startDate</literal>) might be mapped this way:"
|
||||
msgstr ""
|
||||
|
||||
#: association_mapping.xml:617(para)
|
||||
#. Tag: programlisting
|
||||
#: association_mapping.xml:305
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<join>\n"
|
||||
" <key column=\"employeeId\"/>\n"
|
||||
" <subselect>\n"
|
||||
" select employeeId, orgId \n"
|
||||
" from Employments \n"
|
||||
" group by orgId \n"
|
||||
" having startDate = max(startDate)\n"
|
||||
" </subselect>\n"
|
||||
" <many-to-one name=\"mostRecentEmployer\" \n"
|
||||
" class=\"Organization\" \n"
|
||||
" column=\"orgId\"/>\n"
|
||||
"</join>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: association_mapping.xml:307
|
||||
#, no-c-format
|
||||
msgid "You can get quite creative with this functionality, but it is usually more practical to handle these kinds of cases using HQL or a criteria query."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: association_mapping.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,152 +1,373 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:29-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: batch.xml:5(title)
|
||||
#. Tag: title
|
||||
#: batch.xml:29
|
||||
#, no-c-format
|
||||
msgid "Batch processing"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:7(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:31
|
||||
#, no-c-format
|
||||
msgid "A naive approach to inserting 100 000 rows in the database using Hibernate might look like this:"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:21(para)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:36
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"for ( int i=0; i<100000; i++ ) {\n"
|
||||
" Customer customer = new Customer(.....);\n"
|
||||
" session.save(customer);\n"
|
||||
"}\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: batch.xml:38
|
||||
#, no-c-format
|
||||
msgid "This would fall over with an <literal>OutOfMemoryException</literal> somewhere around the 50 000th row. That's because Hibernate caches all the newly inserted <literal>Customer</literal> instances in the session-level cache."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:27(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:44
|
||||
#, no-c-format
|
||||
msgid "In this chapter we'll show you how to avoid this problem. First, however, if you are doing batch processing, it is absolutely critical that you enable the use of JDBC batching, if you intend to achieve reasonable performance. Set the JDBC batch size to a reasonable number (say, 10-50):"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:36(para)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:51
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[hibernate.jdbc.batch_size 20]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: batch.xml:53
|
||||
#, no-c-format
|
||||
msgid "Note that Hibernate disables insert batching at the JDBC level transparently if you use an <literal>identiy</literal> identifier generator."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:41(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:58
|
||||
#, no-c-format
|
||||
msgid "You also might like to do this kind of work in a process where interaction with the second-level cache is completely disabled:"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:48(para)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:63
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[hibernate.cache.use_second_level_cache false]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: batch.xml:65
|
||||
#, no-c-format
|
||||
msgid "However, this is not absolutely necessary, since we can explicitly set the <literal>CacheMode</literal> to disable interaction with the second-level cache."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:54(title)
|
||||
#. Tag: title
|
||||
#: batch.xml:71
|
||||
#, no-c-format
|
||||
msgid "Batch inserts"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:56(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:73
|
||||
#, no-c-format
|
||||
msgid "When making new objects persistent, you must <literal>flush()</literal> and then <literal>clear()</literal> the session regularly, to control the size of the first-level cache."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:81(title)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:79
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"for ( int i=0; i<100000; i++ ) {\n"
|
||||
" Customer customer = new Customer(.....);\n"
|
||||
" session.save(customer);\n"
|
||||
" if ( i % 20 == 0 ) { //20, same as the JDBC batch size\n"
|
||||
" //flush a batch of inserts and release memory:\n"
|
||||
" session.flush();\n"
|
||||
" session.clear();\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: batch.xml:84
|
||||
#, no-c-format
|
||||
msgid "Batch updates"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:83(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:86
|
||||
#, no-c-format
|
||||
msgid "For retrieving and updating data the same ideas apply. In addition, you need to use <literal>scroll()</literal> to take advantage of server-side cursors for queries that return many rows of data."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:112(title)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:92
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n"
|
||||
" .setCacheMode(CacheMode.IGNORE)\n"
|
||||
" .scroll(ScrollMode.FORWARD_ONLY);\n"
|
||||
"int count=0;\n"
|
||||
"while ( customers.next() ) {\n"
|
||||
" Customer customer = (Customer) customers.get(0);\n"
|
||||
" customer.updateStuff(...);\n"
|
||||
" if ( ++count % 20 == 0 ) {\n"
|
||||
" //flush a batch of updates and release memory:\n"
|
||||
" session.flush();\n"
|
||||
" session.clear();\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: batch.xml:97
|
||||
#, no-c-format
|
||||
msgid "The StatelessSession interface"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:113(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:98
|
||||
#, no-c-format
|
||||
msgid "Alternatively, Hibernate provides a command-oriented API that may be used for streaming data to and from the database in the form of detached objects. A <literal>StatelessSession</literal> has no persistence context associated with it and does not provide many of the higher-level life cycle semantics. In particular, a stateless session does not implement a first-level cache nor interact with any second-level or query cache. It does not implement transactional write-behind or automatic dirty checking. Operations performed using a stateless session do not ever cascade to associated instances. Collections are ignored by a stateless session. Operations performed via a stateless session bypass Hibernate's event model and interceptors. Stateless sessions are vulnerable to data aliasing effects, due to the lack of a first-level cache. A stateless session is a lower-level abstraction, much closer to the underlying JDBC."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:142(para)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:113
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[StatelessSession session = sessionFactory.openStatelessSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n"
|
||||
" .scroll(ScrollMode.FORWARD_ONLY);\n"
|
||||
"while ( customers.next() ) {\n"
|
||||
" Customer customer = (Customer) customers.get(0);\n"
|
||||
" customer.updateStuff(...);\n"
|
||||
" session.update(customer);\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: batch.xml:115
|
||||
#, no-c-format
|
||||
msgid "Note that in this code example, the <literal>Customer</literal> instances returned by the query are immediately detached. They are never associated with any persistence context."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:148(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:121
|
||||
#, no-c-format
|
||||
msgid "The <literal>insert(), update()</literal> and <literal>delete()</literal> operations defined by the <literal>StatelessSession</literal> interface are considered to be direct database row-level operations, which result in immediate execution of a SQL <literal>INSERT, UPDATE</literal> or <literal>DELETE</literal> respectively. Thus, they have very different semantics to the <literal>save(), saveOrUpdate()</literal> and <literal>delete()</literal> operations defined by the <literal>Session</literal> interface."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:161(title)
|
||||
#. Tag: title
|
||||
#: batch.xml:134
|
||||
#, no-c-format
|
||||
msgid "DML-style operations"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:163(para)
|
||||
msgid "As already discussed, automatic and transparent object/relational mapping is concerned with the management of object state. This implies that the object state is available in memory, hence manipulating (using the SQL <literal>Data Manipulation Language</literal> (DML) statements: <literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</literal>) data directly in the database will not affect in-memory state. However, Hibernate provides methods for bulk SQL-style DML statement execution which are performed through the Hibernate Query Language (<xref linkend=\"queryhql\">HQL</xref>)."
|
||||
#. Tag: para
|
||||
#: batch.xml:136
|
||||
#, no-c-format
|
||||
msgid "As already discussed, automatic and transparent object/relational mapping is concerned with the management of object state. This implies that the object state is available in memory, hence manipulating (using the SQL <literal>Data Manipulation Language</literal> (DML) statements: <literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</literal>) data directly in the database will not affect in-memory state. However, Hibernate provides methods for bulk SQL-style DML statement execution which are performed through the Hibernate Query Language (<link linkend=\"queryhql\">HQL</link>)."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:173(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:146
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:181(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:154
|
||||
#, no-c-format
|
||||
msgid "In the from-clause, the FROM keyword is optional"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:186(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:159
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:194(para)
|
||||
msgid "No <xref linkend=\"queryhql-joins-forms\">joins</xref> (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."
|
||||
#. Tag: para
|
||||
#: batch.xml:167
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:201(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:174
|
||||
#, no-c-format
|
||||
msgid "The where-clause is also optional."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:207(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:180
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:225(para)
|
||||
msgid "HQL <literal>UPDATE</literal> statements, by default do not effect the <xref linkend=\"mapping-declaration-version\">version</xref> or the <xref linkend=\"mapping-declaration-timestamp\">timestamp</xref> 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."
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:186
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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 ""
|
||||
|
||||
#: batch.xml:245(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:188
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:198
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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-format
|
||||
msgid "Note that custom version types (<literal>org.hibernate.usertype.UserVersionType</literal>) are not allowed in conjunction with a <literal>update versioned</literal> statement."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:250(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:205
|
||||
#, no-c-format
|
||||
msgid "To execute an HQL <literal>DELETE</literal>, use the same <literal>Query.executeUpdate()</literal> method:"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:266(para)
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:210
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:277(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:223
|
||||
#, no-c-format
|
||||
msgid "The pseudo-syntax for <literal>INSERT</literal> statements is: <literal>INSERT INTO EntityName properties_list select_statement</literal>. Some points to note:"
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:285(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:231
|
||||
#, no-c-format
|
||||
msgid "Only the INSERT INTO ... SELECT ... form is supported; not the INSERT INTO ... VALUES ... form."
|
||||
msgstr ""
|
||||
|
||||
#: batch.xml:288(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:234
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:298(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:244
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:310(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:256
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:325(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:271
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: batch.xml:335(para)
|
||||
#. Tag: para
|
||||
#: batch.xml:281
|
||||
#, no-c-format
|
||||
msgid "An example HQL <literal>INSERT</literal> statement execution:"
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: batch.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:285
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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 ""
|
||||
|
||||
|
|
|
@ -1,172 +1,250 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:29-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: best_practices.xml:5(title)
|
||||
#. Tag: title
|
||||
#: best_practices.xml:29
|
||||
#, no-c-format
|
||||
msgid "Best Practices"
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:9(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:33
|
||||
#, no-c-format
|
||||
msgid "Write fine-grained classes and map them using <literal><component></literal>."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:11(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:35
|
||||
#, no-c-format
|
||||
msgid "Use an <literal>Address</literal> class to encapsulate <literal>street</literal>, <literal>suburb</literal>, <literal>state</literal>, <literal>postcode</literal>. This encourages code reuse and simplifies refactoring."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:19(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:43
|
||||
#, no-c-format
|
||||
msgid "Declare identifier properties on persistent classes."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:21(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:45
|
||||
#, no-c-format
|
||||
msgid "Hibernate makes identifier properties optional. There are all sorts of reasons why you should use them. We recommend that identifiers be 'synthetic' (generated, with no business meaning)."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:29(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:53
|
||||
#, no-c-format
|
||||
msgid "Identify natural keys."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:31(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:55
|
||||
#, no-c-format
|
||||
msgid "Identify natural keys for all entities, and map them using <literal><natural-id></literal>. Implement <literal>equals()</literal> and <literal>hashCode()</literal> to compare the properties that make up the natural key."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:39(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:63
|
||||
#, no-c-format
|
||||
msgid "Place each class mapping in its own file."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:41(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:65
|
||||
#, no-c-format
|
||||
msgid "Don't use a single monolithic mapping document. Map <literal>com.eg.Foo</literal> in the file <literal>com/eg/Foo.hbm.xml</literal>. This makes particularly good sense in a team environment."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:49(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:73
|
||||
#, no-c-format
|
||||
msgid "Load mappings as resources."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:51(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:75
|
||||
#, no-c-format
|
||||
msgid "Deploy the mappings along with the classes they map."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:57(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:81
|
||||
#, no-c-format
|
||||
msgid "Consider externalising query strings."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:59(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:83
|
||||
#, no-c-format
|
||||
msgid "This is a good practice if your queries call non-ANSI-standard SQL functions. Externalising the query strings to mapping files will make the application more portable."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:67(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:91
|
||||
#, no-c-format
|
||||
msgid "Use bind variables."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:69(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:93
|
||||
#, no-c-format
|
||||
msgid "As in JDBC, always replace non-constant values by \"?\". Never use string manipulation to bind a non-constant value in a query! Even better, consider using named parameters in queries."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:77(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:101
|
||||
#, no-c-format
|
||||
msgid "Don't manage your own JDBC connections."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:79(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:103
|
||||
#, no-c-format
|
||||
msgid "Hibernate lets the application manage JDBC connections. This approach should be considered a last-resort. If you can't use the built-in connections providers, consider providing your own implementation of <literal>org.hibernate.connection.ConnectionProvider</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:87(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:111
|
||||
#, no-c-format
|
||||
msgid "Consider using a custom type."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:89(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:113
|
||||
#, no-c-format
|
||||
msgid "Suppose you have a Java type, say from some library, that needs to be persisted but doesn't provide the accessors needed to map it as a component. You should consider implementing <literal>org.hibernate.UserType</literal>. This approach frees the application code from implementing transformations to / from a Hibernate type."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:98(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:122
|
||||
#, no-c-format
|
||||
msgid "Use hand-coded JDBC in bottlenecks."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:100(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:124
|
||||
#, no-c-format
|
||||
msgid "In performance-critical areas of the system, some kinds of operations might benefit from direct JDBC. But please, wait until you <emphasis>know</emphasis> something is a bottleneck. And don't assume that direct JDBC is necessarily faster. If you need to use direct JDBC, it might be worth opening a Hibernate <literal>Session</literal> and using that JDBC connection. That way you can still use the same transaction strategy and underlying connection provider."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:110(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:134
|
||||
#, no-c-format
|
||||
msgid "Understand <literal>Session</literal> flushing."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:112(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:136
|
||||
#, no-c-format
|
||||
msgid "From time to time the Session synchronizes its persistent state with the database. Performance will be affected if this process occurs too often. You may sometimes minimize unnecessary flushing by disabling automatic flushing or even by changing the order of queries and other operations within a particular transaction."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:121(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:145
|
||||
#, no-c-format
|
||||
msgid "In a three tiered architecture, consider using detached objects."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:123(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:147
|
||||
#, no-c-format
|
||||
msgid "When using a servlet / session bean architecture, you could pass persistent objects loaded in the session bean to and from the servlet / JSP layer. Use a new session to service each request. Use <literal>Session.merge()</literal> or <literal>Session.saveOrUpdate()</literal> to synchronize objects with the database."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:132(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:156
|
||||
#, no-c-format
|
||||
msgid "In a two tiered architecture, consider using long persistence contexts."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:134(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:158
|
||||
#, no-c-format
|
||||
msgid "Database Transactions have to be as short as possible for best scalability. However, it is often neccessary to implement long running <emphasis>application transactions</emphasis>, a single unit-of-work from the point of view of a user. An application transaction might span several client request/response cycles. It is common to use detached objects to implement application transactions. An alternative, extremely appropriate in two tiered architecture, is to maintain a single open persistence contact (session) for the whole life cycle of the application transaction and simply disconnect from the JDBC connection at the end of each request and reconnect at the beginning of the subsequent request. Never share a single session across more than one application transaction, or you will be working with stale data."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:148(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:172
|
||||
#, no-c-format
|
||||
msgid "Don't treat exceptions as recoverable."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:150(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:174
|
||||
#, no-c-format
|
||||
msgid "This is more of a necessary practice than a \"best\" practice. When an exception occurs, roll back the <literal>Transaction</literal> and close the <literal>Session</literal>. If you don't, Hibernate can't guarantee that in-memory state accurately represents persistent state. As a special case of this, do not use <literal>Session.load()</literal> to determine if an instance with the given identifier exists on the database; use <literal>Session.get()</literal> or a query instead."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:160(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:184
|
||||
#, no-c-format
|
||||
msgid "Prefer lazy fetching for associations."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:162(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:186
|
||||
#, no-c-format
|
||||
msgid "Use eager fetching sparingly. Use proxies and lazy collections for most associations to classes that are not likely to be completely held in the second-level cache. For associations to cached classes, where there is an a extremely high probability of a cache hit, explicitly disable eager fetching using <literal>lazy=\"false\"</literal>. When an join fetching is appropriate to a particular use case, use a query with a <literal>left join fetch</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:172(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:196
|
||||
#, no-c-format
|
||||
msgid "Use the <emphasis>open session in view</emphasis> pattern, or a disciplined <emphasis>assembly phase</emphasis> to avoid problems with unfetched data."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:177(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:201
|
||||
#, no-c-format
|
||||
msgid "Hibernate frees the developer from writing tedious <emphasis>Data Transfer Objects</emphasis> (DTO). In a traditional EJB architecture, DTOs serve dual purposes: first, they work around the problem that entity beans are not serializable; second, they implicitly define an assembly phase where all data to be used by the view is fetched and marshalled into the DTOs before returning control to the presentation tier. Hibernate eliminates the first purpose. However, you will still need an assembly phase (think of your business methods as having a strict contract with the presentation tier about what data is available in the detached objects) unless you are prepared to hold the persistence context (the session) open across the view rendering process. This is not a limitation of Hibernate! It is a fundamental requirement of safe transactional data access."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:191(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:215
|
||||
#, no-c-format
|
||||
msgid "Consider abstracting your business logic from Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:193(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:217
|
||||
#, no-c-format
|
||||
msgid "Hide (Hibernate) data-access code behind an interface. Combine the <emphasis>DAO</emphasis> and <emphasis>Thread Local Session</emphasis> patterns. You can even have some classes persisted by handcoded JDBC, associated to Hibernate via a <literal>UserType</literal>. (This advice is intended for \"sufficiently large\" applications; it is not appropriate for an application with five tables!)"
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:203(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:227
|
||||
#, no-c-format
|
||||
msgid "Don't use exotic association mappings."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:205(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:229
|
||||
#, no-c-format
|
||||
msgid "Good usecases for a real many-to-many associations are rare. Most of the time you need additional information stored in the \"link table\". In this case, it is much better to use two one-to-many associations to an intermediate link class. In fact, we think that most associations are one-to-many and many-to-one, you should be careful when using any other association style and ask yourself if it is really neccessary."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:215(term)
|
||||
#. Tag: term
|
||||
#: best_practices.xml:239
|
||||
#, no-c-format
|
||||
msgid "Prefer bidirectional associations."
|
||||
msgstr ""
|
||||
|
||||
#: best_practices.xml:217(para)
|
||||
#. Tag: para
|
||||
#: best_practices.xml:241
|
||||
#, no-c-format
|
||||
msgid "Unidirectional associations are more difficult to query. In a large application, almost all associations must be navigable in both directions in queries."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: best_practices.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,164 +1,476 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:30-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: component_mapping.xml:5(title)
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:29
|
||||
#, no-c-format
|
||||
msgid "Component Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:7(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:31
|
||||
#, no-c-format
|
||||
msgid "The notion of a <emphasis>component</emphasis> is re-used in several different contexts, for different purposes, throughout Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:13(title)
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:37
|
||||
#, no-c-format
|
||||
msgid "Dependent objects"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:15(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:39
|
||||
#, no-c-format
|
||||
msgid "A component is a contained object that is persisted as a value type, not an entity reference. The term \"component\" refers to the object-oriented notion of composition (not to architecture-level components). For example, you might model a person like this:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:71(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:45
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class Person {\n"
|
||||
" private java.util.Date birthday;\n"
|
||||
" private Name name;\n"
|
||||
" private String key;\n"
|
||||
" public String getKey() {\n"
|
||||
" return key;\n"
|
||||
" }\n"
|
||||
" private void setKey(String key) {\n"
|
||||
" this.key=key;\n"
|
||||
" }\n"
|
||||
" public java.util.Date getBirthday() {\n"
|
||||
" return birthday;\n"
|
||||
" }\n"
|
||||
" public void setBirthday(java.util.Date birthday) {\n"
|
||||
" this.birthday = birthday;\n"
|
||||
" }\n"
|
||||
" public Name getName() {\n"
|
||||
" return name;\n"
|
||||
" }\n"
|
||||
" public void setName(Name name) {\n"
|
||||
" this.name = name;\n"
|
||||
" }\n"
|
||||
" ......\n"
|
||||
" ......\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:47
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class Name {\n"
|
||||
" char initial;\n"
|
||||
" String first;\n"
|
||||
" String last;\n"
|
||||
" public String getFirst() {\n"
|
||||
" return first;\n"
|
||||
" }\n"
|
||||
" void setFirst(String first) {\n"
|
||||
" this.first = first;\n"
|
||||
" }\n"
|
||||
" public String getLast() {\n"
|
||||
" return last;\n"
|
||||
" }\n"
|
||||
" void setLast(String last) {\n"
|
||||
" this.last = last;\n"
|
||||
" }\n"
|
||||
" public char getInitial() {\n"
|
||||
" return initial;\n"
|
||||
" }\n"
|
||||
" void setInitial(char initial) {\n"
|
||||
" this.initial = initial;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:49
|
||||
#, no-c-format
|
||||
msgid "Now <literal>Name</literal> may be persisted as a component of <literal>Person</literal>. Notice that <literal>Name</literal> defines getter and setter methods for its persistent properties, but doesn't need to declare any interfaces or identifier properties."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:78(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:56
|
||||
#, no-c-format
|
||||
msgid "Our Hibernate mapping would look like:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:94(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:60
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Person\" table=\"person\">\n"
|
||||
" <id name=\"Key\" column=\"pid\" type=\"string\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"birthday\" type=\"date\"/>\n"
|
||||
" <component name=\"Name\" class=\"eg.Name\"> <!-- class attribute optional -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </component>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:62
|
||||
#, no-c-format
|
||||
msgid "The person table would have the columns <literal>pid</literal>, <literal>birthday</literal>, <literal>initial</literal>, <literal>first</literal> and <literal>last</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:102(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:70
|
||||
#, no-c-format
|
||||
msgid "Like all value types, components do not support shared references. In other words, two persons could have the same name, but the two person objects would contain two independent name ojects, only \"the same\" by value. The null value semantics of a component are <emphasis>ad hoc</emphasis>. When reloading the containing object, Hibernate will assume that if all component columns are null, then the entire component is null. This should be okay for most purposes."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:111(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:79
|
||||
#, no-c-format
|
||||
msgid "The properties of a component may be of any Hibernate type (collections, many-to-one associations, other components, etc). Nested components should <emphasis>not</emphasis> be considered an exotic usage. Hibernate is intended to support a very fine-grained object model."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:118(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:86
|
||||
#, no-c-format
|
||||
msgid "The <literal><component></literal> element allows a <literal><parent></literal> subelement that maps a property of the component class as a reference back to the containing entity."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:140(title)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:92
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Person\" table=\"person\">\n"
|
||||
" <id name=\"Key\" column=\"pid\" type=\"string\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"birthday\" type=\"date\"/>\n"
|
||||
" <component name=\"Name\" class=\"eg.Name\" unique=\"true\">\n"
|
||||
" <parent name=\"namedPerson\"/> <!-- reference back to the Person -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </component>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:97
|
||||
#, no-c-format
|
||||
msgid "Collections of dependent objects"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:142(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:99
|
||||
#, no-c-format
|
||||
msgid "Collections of components are supported (eg. an array of type <literal>Name</literal>). Declare your component collection by replacing the <literal><element></literal> tag with a <literal><composite-element></literal> tag."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:158(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:106
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"someNames\" table=\"some_names\" lazy=\"true\">\n"
|
||||
" <key column=\"id\"/>\n"
|
||||
" <composite-element class=\"eg.Name\"> <!-- class attribute required -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </composite-element>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:108
|
||||
#, no-c-format
|
||||
msgid "Note: if you define a <literal>Set</literal> of composite elements, it is very important to implement <literal>equals()</literal> and <literal>hashCode()</literal> correctly."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:164(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:114
|
||||
#, no-c-format
|
||||
msgid "Composite elements may contain components but not collections. If your composite element itself contains components, use the <literal><nested-composite-element></literal> tag. This is a pretty exotic case - a collection of components which themselves have components. By this stage you should be asking yourself if a one-to-many association is more appropriate. Try remodelling the composite element as an entity - but note that even though the Java model is the same, the relational model and persistence semantics are still slightly different."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:176(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:126
|
||||
#, no-c-format
|
||||
msgid "Please note that a composite element mapping doesn't support null-able properties if you're using a <literal><set></literal>. Hibernate has to use each columns value to identify a record when deleting objects (there is no separate primary key column in the composite element table), which is not possible with null values. You have to either use only not-null properties in a composite-element or choose a <literal><list></literal>, <literal><map></literal>, <literal><bag></literal> or <literal><idbag></literal>."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:187(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:137
|
||||
#, no-c-format
|
||||
msgid "A special case of a composite element is a composite element with a nested <literal><many-to-one></literal> element. A mapping like this allows you to map extra columns of a many-to-many association table to the composite element class. The following is a many-to-many association from <literal>Order</literal> to <literal>Item</literal> where <literal>purchaseDate</literal>, <literal>price</literal> and <literal>quantity</literal> are properties of the association:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:210(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:147
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Order\" .... >\n"
|
||||
" ....\n"
|
||||
" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"
|
||||
" <key column=\"order_id\">\n"
|
||||
" <composite-element class=\"eg.Purchase\">\n"
|
||||
" <property name=\"purchaseDate\"/>\n"
|
||||
" <property name=\"price\"/>\n"
|
||||
" <property name=\"quantity\"/>\n"
|
||||
" <many-to-one name=\"item\" class=\"eg.Item\"/> <!-- class attribute is optional -->\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:149
|
||||
#, no-c-format
|
||||
msgid "Of course, there can't be a reference to the purchae on the other side, for bidirectional association navigation. Remember that components are value types and don't allow shared references. A single <literal>Purchase</literal> can be in the set of an <literal>Order</literal>, but it can't be referenced by the <literal>Item</literal> at the same time."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:218(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:157
|
||||
#, no-c-format
|
||||
msgid "Even ternary (or quaternary, etc) associations are possible:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:231(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:159
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Order\" .... >\n"
|
||||
" ....\n"
|
||||
" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"
|
||||
" <key column=\"order_id\">\n"
|
||||
" <composite-element class=\"eg.OrderLine\">\n"
|
||||
" <many-to-one name=\"purchaseDetails class=\"eg.Purchase\"/>\n"
|
||||
" <many-to-one name=\"item\" class=\"eg.Item\"/>\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:161
|
||||
#, no-c-format
|
||||
msgid "Composite elements may appear in queries using the same syntax as associations to other entities."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:239(title)
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:169
|
||||
#, no-c-format
|
||||
msgid "Components as Map indices"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:241(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:171
|
||||
#, no-c-format
|
||||
msgid "The <literal><composite-map-key></literal> element lets you map a component class as the key of a <literal>Map</literal>. Make sure you override <literal>hashCode()</literal> and <literal>equals()</literal> correctly on the component class."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:250(title)
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:180
|
||||
#, no-c-format
|
||||
msgid "Components as composite identifiers"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:252(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:182
|
||||
#, no-c-format
|
||||
msgid "You may use a component as an identifier of an entity class. Your component class must satisfy certain requirements:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:259(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:189
|
||||
#, no-c-format
|
||||
msgid "It must implement <literal>java.io.Serializable</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:264(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:194
|
||||
#, no-c-format
|
||||
msgid "It must re-implement <literal>equals()</literal> and <literal>hashCode()</literal>, consistently with the database's notion of composite key equality."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:273(emphasis)
|
||||
#. Tag: emphasis
|
||||
#: component_mapping.xml:203
|
||||
#, no-c-format
|
||||
msgid "Note: in Hibernate3, the second requirement is not an absolutely hard requirement of Hibernate. But do it anyway."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:277(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:207
|
||||
#, no-c-format
|
||||
msgid "You can't use an <literal>IdentifierGenerator</literal> to generate composite keys. Instead the application must assign its own identifiers."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:282(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:212
|
||||
#, no-c-format
|
||||
msgid "Use the <literal><composite-id></literal> tag (with nested <literal><key-property></literal> elements) in place of the usual <literal><id></literal> declaration. For example, the <literal>OrderLine</literal> class has a primary key that depends upon the (composite) primary key of <literal>Order</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:309(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:220
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"OrderLine\">\n"
|
||||
" \n"
|
||||
" <composite-id name=\"id\" class=\"OrderLineId\">\n"
|
||||
" <key-property name=\"lineId\"/>\n"
|
||||
" <key-property name=\"orderId\"/>\n"
|
||||
" <key-property name=\"customerId\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" \n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"order\" class=\"Order\"\n"
|
||||
" insert=\"false\" update=\"false\">\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </many-to-one>\n"
|
||||
" ....\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:222
|
||||
#, no-c-format
|
||||
msgid "Now, any foreign keys referencing the <literal>OrderLine</literal> table are also composite. You must declare this in your mappings for other classes. An association to <literal>OrderLine</literal> would be mapped like this:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:322(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:228
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<many-to-one name=\"orderLine\" class=\"OrderLine\">\n"
|
||||
"<!-- the \"class\" attribute is optional, as usual -->\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
"</many-to-one>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:230
|
||||
#, no-c-format
|
||||
msgid "(Note that the <literal><column></literal> tag is an alternative to the <literal>column</literal> attribute everywhere.)"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:327(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:235
|
||||
#, no-c-format
|
||||
msgid "A <literal>many-to-many</literal> association to <literal>OrderLine</literal> also uses the composite foreign key:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:341(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:240
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"undeliveredOrderLines\">\n"
|
||||
" <key column name=\"warehouseId\"/>\n"
|
||||
" <many-to-many class=\"OrderLine\">\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </many-to-many>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:242
|
||||
#, no-c-format
|
||||
msgid "The collection of <literal>OrderLine</literal>s in <literal>Order</literal> would use:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:354(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:247
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"orderLines\" inverse=\"true\">\n"
|
||||
" <key>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </key>\n"
|
||||
" <one-to-many class=\"OrderLine\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:249
|
||||
#, no-c-format
|
||||
msgid "(The <literal><one-to-many></literal> element, as usual, declares no columns.)"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:358(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:253
|
||||
#, no-c-format
|
||||
msgid "If <literal>OrderLine</literal> itself owns a collection, it also has a composite foreign key."
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:382(title)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:258
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"OrderLine\">\n"
|
||||
" ....\n"
|
||||
" ....\n"
|
||||
" <list name=\"deliveryAttempts\">\n"
|
||||
" <key> <!-- a collection inherits the composite key type -->\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </key>\n"
|
||||
" <list-index column=\"attemptId\" base=\"1\"/>\n"
|
||||
" <composite-element class=\"DeliveryAttempt\">\n"
|
||||
" ...\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:263
|
||||
#, no-c-format
|
||||
msgid "Dynamic components"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:384(para)
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:265
|
||||
#, no-c-format
|
||||
msgid "You may even map a property of type <literal>Map</literal>:"
|
||||
msgstr ""
|
||||
|
||||
#: component_mapping.xml:394(para)
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:269
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<dynamic-component name=\"userAttributes\">\n"
|
||||
" <property name=\"foo\" column=\"FOO\" type=\"string\"/>\n"
|
||||
" <property name=\"bar\" column=\"BAR\" type=\"integer\"/>\n"
|
||||
" <many-to-one name=\"baz\" class=\"Baz\" column=\"BAZ_ID\"/>\n"
|
||||
"</dynamic-component>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:271
|
||||
#, no-c-format
|
||||
msgid "The semantics of a <literal><dynamic-component></literal> mapping are identical to <literal><component></literal>. The advantage of this kind of mapping is the ability to determine the actual properties of the bean at deployment time, just by editing the mapping document. Runtime manipulation of the mapping document is also possible, using a DOM parser. Even better, you can access (and change) Hibernate's configuration-time metamodel via the <literal>Configuration</literal> object."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: component_mapping.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,108 +1,311 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:31-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: events.xml:5(title)
|
||||
#. Tag: title
|
||||
#: events.xml:29
|
||||
#, no-c-format
|
||||
msgid "Interceptors and events"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:7(para)
|
||||
#. Tag: para
|
||||
#: events.xml:31
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: events.xml:14(title)
|
||||
#. Tag: title
|
||||
#: events.xml:38
|
||||
#, no-c-format
|
||||
msgid "Interceptors"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:16(para)
|
||||
#. Tag: para
|
||||
#: events.xml:40
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: events.xml:27(para)
|
||||
#. Tag: para
|
||||
#: events.xml:51
|
||||
#, no-c-format
|
||||
msgid "You may either implement <literal>Interceptor</literal> directly or (better) extend <literal>EmptyInterceptor</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:115(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:56
|
||||
#, no-c-format
|
||||
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 ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:58
|
||||
#, no-c-format
|
||||
msgid "Interceptors come in two flavors: <literal>Session</literal>-scoped and <literal>SessionFactory</literal>-scoped."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:120(para)
|
||||
#. Tag: para
|
||||
#: events.xml:63
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: events.xml:128(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:69
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:71
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: events.xml:142(title)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:80
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: events.xml:85
|
||||
#, no-c-format
|
||||
msgid "Event system"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:144(para)
|
||||
#. Tag: para
|
||||
#: events.xml:87
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: events.xml:150(para)
|
||||
#. Tag: para
|
||||
#: events.xml:93
|
||||
#, no-c-format
|
||||
msgid "Essentially all of the methods of the <literal>Session</literal> interface correlate to an event. You have a <literal>LoadEvent</literal>, a <literal>FlushEvent</literal>, etc (consult the XML configuration-file DTD or the <literal>org.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</literal> 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</literal> is processed by the registered implemenation of the <literal>LoadEventListener</literal> interface), in which case their implementation would be responsible for processing any <literal>load()</literal> requests made of the <literal>Session</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:165(para)
|
||||
#. Tag: para
|
||||
#: events.xml:108
|
||||
#, no-c-format
|
||||
msgid "The listeners should be considered effectively singletons; meaning, they are shared between requests, and thus should not save any state as instance variables."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:170(para)
|
||||
#. Tag: para
|
||||
#: events.xml:113
|
||||
#, no-c-format
|
||||
msgid "A custom listener should implement 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</literal> object, or specified in the Hibernate configuration XML (declarative configuration through the properties file is not supported). Here's an example of a custom load event listener:"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:190(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:123
|
||||
#, no-c-format
|
||||
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 ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:125
|
||||
#, no-c-format
|
||||
msgid "You also need a configuration entry telling Hibernate to use the listener in addition to the default listener:"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:205(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:130
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<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>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:132
|
||||
#, no-c-format
|
||||
msgid "Instead, you may register it programmatically:"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:213(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:136
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Configuration cfg = new Configuration();\n"
|
||||
"LoadEventListener[] stack = { new MyLoadListener(), new DefaultLoadEventListener() };\n"
|
||||
"cfg.EventListeners().setLoadEventListeners(stack);]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:138
|
||||
#, no-c-format
|
||||
msgid "Listeners registered declaratively cannot share instances. If the same class name is used in multiple <literal><listener/></literal> elements, each reference will result in a separate instance of that class. If you need the capability to share listener instances between listener types you must use the programmatic registration approach."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:221(para)
|
||||
#. Tag: para
|
||||
#: events.xml:146
|
||||
#, no-c-format
|
||||
msgid "Why implement an interface and define the specific type during configuration? Well, 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 ""
|
||||
|
||||
#: events.xml:231(title)
|
||||
#. Tag: title
|
||||
#: events.xml:156
|
||||
#, no-c-format
|
||||
msgid "Hibernate declarative security"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:232(para)
|
||||
#. Tag: para
|
||||
#: events.xml:157
|
||||
#, no-c-format
|
||||
msgid "Usually, declarative security in Hibernate applications is managed in a session facade layer. Now, Hibernate3 allows certain actions to be permissioned via JACC, and authorized via JAAS. This is optional functionality built on top of the event architecture."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:238(para)
|
||||
#. Tag: para
|
||||
#: events.xml:163
|
||||
#, no-c-format
|
||||
msgid "First, you must configure the appropriate event listeners, to enable the use of JAAS authorization."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:248(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:168
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<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\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:170
|
||||
#, no-c-format
|
||||
msgid "Note that <literal><listener type=\"...\" class=\"...\"/></literal> is just a shorthand for <literal><event type=\"...\"><listener class=\"...\"/></event></literal> when there is exactly one listener for a particular event type."
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:254(para)
|
||||
#. Tag: para
|
||||
#: events.xml:176
|
||||
#, no-c-format
|
||||
msgid "Next, still in <literal>hibernate.cfg.xml</literal>, bind the permissions to roles:"
|
||||
msgstr ""
|
||||
|
||||
#: events.xml:261(para)
|
||||
#. Tag: programlisting
|
||||
#: events.xml:180
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,read\"/>\n"
|
||||
"<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:182
|
||||
#, no-c-format
|
||||
msgid "The role names are the roles understood by your JACC provider."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: events.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,122 +1,723 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:31-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: example_mappings.xml:39(None) example_mappings.xml:42(None)
|
||||
msgid "@@image: '../images/EmployerEmployee.png'; md5=51e3da273e772b7defc753746eb5223f"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: example_mappings.xml:153(None) example_mappings.xml:156(None)
|
||||
msgid "@@image: '../images/AuthorWork.png'; md5=fdbc5f105890c04d206674e7df6af6cf"
|
||||
msgstr ""
|
||||
|
||||
#. When image changes, this message will be marked fuzzy or untranslated for you.
|
||||
#. It doesn't matter what you translate it to: it's not used at all.
|
||||
#: example_mappings.xml:277(None) example_mappings.xml:280(None)
|
||||
msgid "@@image: '../images/CustomerOrderProduct.png'; md5=39dcb639a197684dc020904a3f9a4b3d"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:20(title)
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:29
|
||||
#, no-c-format
|
||||
msgid "Example: Various Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:22(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:31
|
||||
#, no-c-format
|
||||
msgid "This chapters shows off some more complex association mappings."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:27(title)
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:36
|
||||
#, no-c-format
|
||||
msgid "Employer/Employee"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:29(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:38
|
||||
#, no-c-format
|
||||
msgid "The following model of the relationship between <literal>Employer</literal> and <literal>Employee</literal> uses an actual entity class (<literal>Employment</literal>) to represent the association. This is done because there might be more than one period of employment for the same two parties. Components are used to model monetary values and employee names."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:46(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:55
|
||||
#, no-c-format
|
||||
msgid "Heres a possible mapping document:"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:99(para)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:59
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-mapping>\n"
|
||||
" \n"
|
||||
" <class name=\"Employer\" table=\"employers\">\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"sequence\">\n"
|
||||
" <param name=\"sequence\">employer_id_seq</param>\n"
|
||||
" </generator>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
" <class name=\"Employment\" table=\"employment_periods\">\n"
|
||||
"\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"sequence\">\n"
|
||||
" <param name=\"sequence\">employment_id_seq</param>\n"
|
||||
" </generator>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"startDate\" column=\"start_date\"/>\n"
|
||||
" <property name=\"endDate\" column=\"end_date\"/>\n"
|
||||
"\n"
|
||||
" <component name=\"hourlyRate\" class=\"MonetaryAmount\">\n"
|
||||
" <property name=\"amount\">\n"
|
||||
" <column name=\"hourly_rate\" sql-type=\"NUMERIC(12, 2)\"/>\n"
|
||||
" </property>\n"
|
||||
" <property name=\"currency\" length=\"12\"/>\n"
|
||||
" </component>\n"
|
||||
"\n"
|
||||
" <many-to-one name=\"employer\" column=\"employer_id\" not-null=\"true\"/>\n"
|
||||
" <many-to-one name=\"employee\" column=\"employee_id\" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
" <class name=\"Employee\" table=\"employees\">\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"sequence\">\n"
|
||||
" <param name=\"sequence\">employee_id_seq</param>\n"
|
||||
" </generator>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"taxfileNumber\"/>\n"
|
||||
" <component name=\"name\" class=\"Name\">\n"
|
||||
" <property name=\"firstName\"/>\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"lastName\"/>\n"
|
||||
" </component>\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:61
|
||||
#, no-c-format
|
||||
msgid "And heres the table schema generated by <literal>SchemaExport</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:140(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:65
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[create table employers (\n"
|
||||
" id BIGINT not null, \n"
|
||||
" name VARCHAR(255), \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table employment_periods (\n"
|
||||
" id BIGINT not null,\n"
|
||||
" hourly_rate NUMERIC(12, 2),\n"
|
||||
" currency VARCHAR(12), \n"
|
||||
" employee_id BIGINT not null, \n"
|
||||
" employer_id BIGINT not null, \n"
|
||||
" end_date TIMESTAMP, \n"
|
||||
" start_date TIMESTAMP, \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table employees (\n"
|
||||
" id BIGINT not null, \n"
|
||||
" firstName VARCHAR(255), \n"
|
||||
" initial CHAR(1), \n"
|
||||
" lastName VARCHAR(255), \n"
|
||||
" taxfileNumber VARCHAR(255), \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"alter table employment_periods \n"
|
||||
" add constraint employment_periodsFK0 foreign key (employer_id) references employers\n"
|
||||
"alter table employment_periods \n"
|
||||
" add constraint employment_periodsFK1 foreign key (employee_id) references employees\n"
|
||||
"create sequence employee_id_seq\n"
|
||||
"create sequence employment_id_seq\n"
|
||||
"create sequence employer_id_seq]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:70
|
||||
#, no-c-format
|
||||
msgid "Author/Work"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:142(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:72
|
||||
#, no-c-format
|
||||
msgid "Consider the following model of the relationships between <literal>Work</literal>, <literal>Author</literal> and <literal>Person</literal>. We represent the relationship between <literal>Work</literal> and <literal>Author</literal> as a many-to-many association. We choose to represent the relationship between <literal>Author</literal> and <literal>Person</literal> as one-to-one association. Another possibility would be to have <literal>Author</literal> extend <literal>Person</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:160(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:90
|
||||
#, no-c-format
|
||||
msgid "The following mapping document correctly represents these relationships:"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:216(para)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:94
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-mapping>\n"
|
||||
"\n"
|
||||
" <class name=\"Work\" table=\"works\" discriminator-value=\"W\">\n"
|
||||
"\n"
|
||||
" <id name=\"id\" column=\"id\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <discriminator column=\"type\" type=\"character\"/>\n"
|
||||
"\n"
|
||||
" <property name=\"title\"/>\n"
|
||||
" <set name=\"authors\" table=\"author_work\">\n"
|
||||
" <key column name=\"work_id\"/>\n"
|
||||
" <many-to-many class=\"Author\" column name=\"author_id\"/>\n"
|
||||
" </set>\n"
|
||||
"\n"
|
||||
" <subclass name=\"Book\" discriminator-value=\"B\">\n"
|
||||
" <property name=\"text\"/>\n"
|
||||
" </subclass>\n"
|
||||
"\n"
|
||||
" <subclass name=\"Song\" discriminator-value=\"S\">\n"
|
||||
" <property name=\"tempo\"/>\n"
|
||||
" <property name=\"genre\"/>\n"
|
||||
" </subclass>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
" <class name=\"Author\" table=\"authors\">\n"
|
||||
"\n"
|
||||
" <id name=\"id\" column=\"id\">\n"
|
||||
" <!-- The Author must have the same identifier as the Person -->\n"
|
||||
" <generator class=\"assigned\"/> \n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property name=\"alias\"/>\n"
|
||||
" <one-to-one name=\"person\" constrained=\"true\"/>\n"
|
||||
"\n"
|
||||
" <set name=\"works\" table=\"author_work\" inverse=\"true\">\n"
|
||||
" <key column=\"author_id\"/>\n"
|
||||
" <many-to-many class=\"Work\" column=\"work_id\"/>\n"
|
||||
" </set>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
" <class name=\"Person\" table=\"persons\">\n"
|
||||
" <id name=\"id\" column=\"id\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:96
|
||||
#, no-c-format
|
||||
msgid "There are four tables in this mapping. <literal>works</literal>, <literal>authors</literal> and <literal>persons</literal> hold work, author and person data respectively. <literal>author_work</literal> is an association table linking authors to works. Heres the table schema, as generated by <literal>SchemaExport</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:262(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:104
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[create table works (\n"
|
||||
" id BIGINT not null generated by default as identity, \n"
|
||||
" tempo FLOAT, \n"
|
||||
" genre VARCHAR(255), \n"
|
||||
" text INTEGER, \n"
|
||||
" title VARCHAR(255), \n"
|
||||
" type CHAR(1) not null, \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table author_work (\n"
|
||||
" author_id BIGINT not null, \n"
|
||||
" work_id BIGINT not null, \n"
|
||||
" primary key (work_id, author_id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table authors (\n"
|
||||
" id BIGINT not null generated by default as identity, \n"
|
||||
" alias VARCHAR(255), \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table persons (\n"
|
||||
" id BIGINT not null generated by default as identity, \n"
|
||||
" name VARCHAR(255), \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"alter table authors \n"
|
||||
" add constraint authorsFK0 foreign key (id) references persons\n"
|
||||
"alter table author_work \n"
|
||||
" add constraint author_workFK0 foreign key (author_id) references authors\n"
|
||||
"alter table author_work\n"
|
||||
" add constraint author_workFK1 foreign key (work_id) references works]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:109
|
||||
#, no-c-format
|
||||
msgid "Customer/Order/Product"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:264(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:111
|
||||
#, no-c-format
|
||||
msgid "Now consider a model of the relationships between <literal>Customer</literal>, <literal>Order</literal> and <literal>LineItem</literal> and <literal>Product</literal>. There is a one-to-many association between <literal>Customer</literal> and <literal>Order</literal>, but how should we represent <literal>Order</literal> / <literal>LineItem</literal> / <literal>Product</literal>? I've chosen to map <literal>LineItem</literal> as an association class representing the many-to-many association between <literal>Order</literal> and <literal>Product</literal>. In Hibernate, this is called a composite element."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:284(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:131
|
||||
#, no-c-format
|
||||
msgid "The mapping document:"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:326(para)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:135
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-mapping>\n"
|
||||
"\n"
|
||||
" <class name=\"Customer\" table=\"customers\">\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" <set name=\"orders\" inverse=\"true\">\n"
|
||||
" <key column=\"customer_id\"/>\n"
|
||||
" <one-to-many class=\"Order\"/>\n"
|
||||
" </set>\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
" <class name=\"Order\" table=\"orders\">\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"date\"/>\n"
|
||||
" <many-to-one name=\"customer\" column=\"customer_id\"/>\n"
|
||||
" <list name=\"lineItems\" table=\"line_items\">\n"
|
||||
" <key column=\"order_id\"/>\n"
|
||||
" <list-index column=\"line_number\"/>\n"
|
||||
" <composite-element class=\"LineItem\">\n"
|
||||
" <property name=\"quantity\"/>\n"
|
||||
" <many-to-one name=\"product\" column=\"product_id\"/>\n"
|
||||
" </composite-element>\n"
|
||||
" </list>\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
" <class name=\"Product\" table=\"products\">\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"serialNumber\"/>\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:137
|
||||
#, no-c-format
|
||||
msgid "<literal>customers</literal>, <literal>orders</literal>, <literal>line_items</literal> and <literal>products</literal> hold customer, order, order line item and product data respectively. <literal>line_items</literal> also acts as an association table linking orders with products."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:370(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:144
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[create table customers (\n"
|
||||
" id BIGINT not null generated by default as identity, \n"
|
||||
" name VARCHAR(255), \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table orders (\n"
|
||||
" id BIGINT not null generated by default as identity, \n"
|
||||
" customer_id BIGINT, \n"
|
||||
" date TIMESTAMP, \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table line_items (\n"
|
||||
" line_number INTEGER not null, \n"
|
||||
" order_id BIGINT not null, \n"
|
||||
" product_id BIGINT, \n"
|
||||
" quantity INTEGER, \n"
|
||||
" primary key (order_id, line_number)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"create table products (\n"
|
||||
" id BIGINT not null generated by default as identity, \n"
|
||||
" serialNumber VARCHAR(255), \n"
|
||||
" primary key (id)\n"
|
||||
")\n"
|
||||
"\n"
|
||||
"alter table orders \n"
|
||||
" add constraint ordersFK0 foreign key (customer_id) references customers\n"
|
||||
"alter table line_items\n"
|
||||
" add constraint line_itemsFK0 foreign key (product_id) references products\n"
|
||||
"alter table line_items\n"
|
||||
" add constraint line_itemsFK1 foreign key (order_id) references orders]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:149
|
||||
#, no-c-format
|
||||
msgid "Miscellaneous example mappings"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:372(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:151
|
||||
#, no-c-format
|
||||
msgid "These examples are all taken from the Hibernate test suite. You will find many other useful example mappings there. Look in the <literal>test</literal> folder of the Hibernate distribution."
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:378(para)
|
||||
#. Tag: para
|
||||
#: example_mappings.xml:157
|
||||
#, no-c-format
|
||||
msgid "TODO: put words around this stuff"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:381(title)
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:160
|
||||
#, no-c-format
|
||||
msgid "\"Typed\" one-to-one association"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:411(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:161
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" <id name=\"name\"/>\n"
|
||||
" <one-to-one name=\"address\" \n"
|
||||
" cascade=\"all\">\n"
|
||||
" <formula>name</formula>\n"
|
||||
" <formula>'HOME'</formula>\n"
|
||||
" </one-to-one>\n"
|
||||
" <one-to-one name=\"mailingAddress\" \n"
|
||||
" cascade=\"all\">\n"
|
||||
" <formula>name</formula>\n"
|
||||
" <formula>'MAILING'</formula>\n"
|
||||
" </one-to-one>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\" batch-size=\"2\" \n"
|
||||
" check=\"addressType in ('MAILING', 'HOME', 'BUSINESS')\">\n"
|
||||
" <composite-id>\n"
|
||||
" <key-many-to-one name=\"person\" \n"
|
||||
" column=\"personName\"/>\n"
|
||||
" <key-property name=\"type\" \n"
|
||||
" column=\"addressType\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" <property name=\"street\" type=\"text\"/>\n"
|
||||
" <property name=\"state\"/>\n"
|
||||
" <property name=\"zip\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:165
|
||||
#, no-c-format
|
||||
msgid "Composite key example"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:528(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:166
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Customer\">\n"
|
||||
"\n"
|
||||
" <id name=\"customerId\"\n"
|
||||
" length=\"10\">\n"
|
||||
" <generator class=\"assigned\"/>\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property name=\"name\" not-null=\"true\" length=\"100\"/>\n"
|
||||
" <property name=\"address\" not-null=\"true\" length=\"200\"/>\n"
|
||||
"\n"
|
||||
" <list name=\"orders\"\n"
|
||||
" inverse=\"true\"\n"
|
||||
" cascade=\"save-update\">\n"
|
||||
" <key column=\"customerId\"/>\n"
|
||||
" <index column=\"orderNumber\"/>\n"
|
||||
" <one-to-many class=\"Order\"/>\n"
|
||||
" </list>\n"
|
||||
"\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Order\" table=\"CustomerOrder\" lazy=\"true\">\n"
|
||||
" <synchronize table=\"LineItem\"/>\n"
|
||||
" <synchronize table=\"Product\"/>\n"
|
||||
" \n"
|
||||
" <composite-id name=\"id\" \n"
|
||||
" class=\"Order$Id\">\n"
|
||||
" <key-property name=\"customerId\" length=\"10\"/>\n"
|
||||
" <key-property name=\"orderNumber\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" \n"
|
||||
" <property name=\"orderDate\" \n"
|
||||
" type=\"calendar_date\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"total\">\n"
|
||||
" <formula>\n"
|
||||
" ( select sum(li.quantity*p.price) \n"
|
||||
" from LineItem li, Product p \n"
|
||||
" where li.productId = p.productId \n"
|
||||
" and li.customerId = customerId \n"
|
||||
" and li.orderNumber = orderNumber )\n"
|
||||
" </formula>\n"
|
||||
" </property>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customer\"\n"
|
||||
" column=\"customerId\"\n"
|
||||
" insert=\"false\"\n"
|
||||
" update=\"false\" \n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" \n"
|
||||
" <bag name=\"lineItems\"\n"
|
||||
" fetch=\"join\" \n"
|
||||
" inverse=\"true\"\n"
|
||||
" cascade=\"save-update\">\n"
|
||||
" <key>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" <column name=\"orderNumber\"/>\n"
|
||||
" </key>\n"
|
||||
" <one-to-many class=\"LineItem\"/>\n"
|
||||
" </bag>\n"
|
||||
" \n"
|
||||
"</class>\n"
|
||||
" \n"
|
||||
"<class name=\"LineItem\">\n"
|
||||
" \n"
|
||||
" <composite-id name=\"id\" \n"
|
||||
" class=\"LineItem$Id\">\n"
|
||||
" <key-property name=\"customerId\" length=\"10\"/>\n"
|
||||
" <key-property name=\"orderNumber\"/>\n"
|
||||
" <key-property name=\"productId\" length=\"10\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" \n"
|
||||
" <property name=\"quantity\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"order\"\n"
|
||||
" insert=\"false\"\n"
|
||||
" update=\"false\" \n"
|
||||
" not-null=\"true\">\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" <column name=\"orderNumber\"/>\n"
|
||||
" </many-to-one>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"product\"\n"
|
||||
" insert=\"false\"\n"
|
||||
" update=\"false\" \n"
|
||||
" not-null=\"true\"\n"
|
||||
" column=\"productId\"/>\n"
|
||||
" \n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Product\">\n"
|
||||
" <synchronize table=\"LineItem\"/>\n"
|
||||
"\n"
|
||||
" <id name=\"productId\"\n"
|
||||
" length=\"10\">\n"
|
||||
" <generator class=\"assigned\"/>\n"
|
||||
" </id>\n"
|
||||
" \n"
|
||||
" <property name=\"description\" \n"
|
||||
" not-null=\"true\" \n"
|
||||
" length=\"200\"/>\n"
|
||||
" <property name=\"price\" length=\"3\"/>\n"
|
||||
" <property name=\"numberAvailable\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"numberOrdered\">\n"
|
||||
" <formula>\n"
|
||||
" ( select sum(li.quantity) \n"
|
||||
" from LineItem li \n"
|
||||
" where li.productId = productId )\n"
|
||||
" </formula>\n"
|
||||
" </property>\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:170
|
||||
#, no-c-format
|
||||
msgid "Many-to-many with shared composite key attribute"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:567(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:171
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"User\" table=\"`User`\">\n"
|
||||
" <composite-id>\n"
|
||||
" <key-property name=\"name\"/>\n"
|
||||
" <key-property name=\"org\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" <set name=\"groups\" table=\"UserGroup\">\n"
|
||||
" <key>\n"
|
||||
" <column name=\"userName\"/>\n"
|
||||
" <column name=\"org\"/>\n"
|
||||
" </key>\n"
|
||||
" <many-to-many class=\"Group\">\n"
|
||||
" <column name=\"groupName\"/>\n"
|
||||
" <formula>org</formula>\n"
|
||||
" </many-to-many>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
" \n"
|
||||
"<class name=\"Group\" table=\"`Group`\">\n"
|
||||
" <composite-id>\n"
|
||||
" <key-property name=\"name\"/>\n"
|
||||
" <key-property name=\"org\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" <property name=\"description\"/>\n"
|
||||
" <set name=\"users\" table=\"UserGroup\" inverse=\"true\">\n"
|
||||
" <key>\n"
|
||||
" <column name=\"groupName\"/>\n"
|
||||
" <column name=\"org\"/>\n"
|
||||
" </key>\n"
|
||||
" <many-to-many class=\"User\">\n"
|
||||
" <column name=\"userName\"/>\n"
|
||||
" <formula>org</formula>\n"
|
||||
" </many-to-many>\n"
|
||||
" </set>\n"
|
||||
"</class>\n"
|
||||
"]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:175
|
||||
#, no-c-format
|
||||
msgid "Content based discrimination"
|
||||
msgstr ""
|
||||
|
||||
#: example_mappings.xml:621(title)
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:176
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\"\n"
|
||||
" discriminator-value=\"P\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"person_id\" \n"
|
||||
" unsaved-value=\"0\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" \n"
|
||||
" \n"
|
||||
" <discriminator \n"
|
||||
" type=\"character\">\n"
|
||||
" <formula>\n"
|
||||
" case \n"
|
||||
" when title is not null then 'E' \n"
|
||||
" when salesperson is not null then 'C' \n"
|
||||
" else 'P' \n"
|
||||
" end\n"
|
||||
" </formula>\n"
|
||||
" </discriminator>\n"
|
||||
"\n"
|
||||
" <property name=\"name\" \n"
|
||||
" not-null=\"true\"\n"
|
||||
" length=\"80\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"sex\" \n"
|
||||
" not-null=\"true\"\n"
|
||||
" update=\"false\"/>\n"
|
||||
" \n"
|
||||
" <component name=\"address\">\n"
|
||||
" <property name=\"address\"/>\n"
|
||||
" <property name=\"zip\"/>\n"
|
||||
" <property name=\"country\"/>\n"
|
||||
" </component>\n"
|
||||
" \n"
|
||||
" <subclass name=\"Employee\" \n"
|
||||
" discriminator-value=\"E\">\n"
|
||||
" <property name=\"title\"\n"
|
||||
" length=\"20\"/>\n"
|
||||
" <property name=\"salary\"/>\n"
|
||||
" <many-to-one name=\"manager\"/>\n"
|
||||
" </subclass>\n"
|
||||
" \n"
|
||||
" <subclass name=\"Customer\" \n"
|
||||
" discriminator-value=\"C\">\n"
|
||||
" <property name=\"comments\"/>\n"
|
||||
" <many-to-one name=\"salesperson\"/>\n"
|
||||
" </subclass>\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_mappings.xml:180
|
||||
#, no-c-format
|
||||
msgid "Associations on alternate keys"
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: example_mappings.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
#. Tag: programlisting
|
||||
#: example_mappings.xml:181
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Person\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"hilo\"/>\n"
|
||||
" </id>\n"
|
||||
" \n"
|
||||
" <property name=\"name\" length=\"100\"/>\n"
|
||||
" \n"
|
||||
" <one-to-one name=\"address\" \n"
|
||||
" property-ref=\"person\"\n"
|
||||
" cascade=\"all\"\n"
|
||||
" fetch=\"join\"/>\n"
|
||||
" \n"
|
||||
" <set name=\"accounts\" \n"
|
||||
" inverse=\"true\">\n"
|
||||
" <key column=\"userId\"\n"
|
||||
" property-ref=\"userId\"/>\n"
|
||||
" <one-to-many class=\"Account\"/>\n"
|
||||
" </set>\n"
|
||||
" \n"
|
||||
" <property name=\"userId\" length=\"8\"/>\n"
|
||||
"\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Address\">\n"
|
||||
"\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"hilo\"/>\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property name=\"address\" length=\"300\"/>\n"
|
||||
" <property name=\"zip\" length=\"5\"/>\n"
|
||||
" <property name=\"country\" length=\"25\"/>\n"
|
||||
" <many-to-one name=\"person\" unique=\"true\" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Account\">\n"
|
||||
" <id name=\"accountId\" length=\"32\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"user\"\n"
|
||||
" column=\"userId\"\n"
|
||||
" property-ref=\"userId\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"type\" not-null=\"true\"/>\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,168 +1,397 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:31-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: example_parentchild.xml:5(title)
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:29
|
||||
#, no-c-format
|
||||
msgid "Example: Parent/Child"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:7(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:31
|
||||
#, no-c-format
|
||||
msgid "One of the very first things that new users try to do with Hibernate is to model a parent / child type relationship. There are two different approaches to this. For various reasons the most convenient approach, especially for new users, is to model both <literal>Parent</literal> and <literal>Child</literal> as entity classes with a <literal><one-to-many></literal> association from <literal>Parent</literal> to <literal>Child</literal>. (The alternative approach is to declare the <literal>Child</literal> as a <literal><composite-element></literal>.) Now, it turns out that default semantics of a one to many association (in Hibernate) are much less close to the usual semantics of a parent / child relationship than those of a composite element mapping. We will explain how to use a <emphasis>bidirectional one to many association with cascades</emphasis> to model a parent / child relationship efficiently and elegantly. It's not at all difficult!"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:21(title)
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:45
|
||||
#, no-c-format
|
||||
msgid "A note about collections"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:23(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:47
|
||||
#, no-c-format
|
||||
msgid "Hibernate collections are considered to be a logical part of their owning entity; never of the contained entities. This is a crucial distinction! It has the following consequences:"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:30(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:54
|
||||
#, no-c-format
|
||||
msgid "When we remove / add an object from / to a collection, the version number of the collection owner is incremented."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:36(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:60
|
||||
#, no-c-format
|
||||
msgid "If an object that was removed from a collection is an instance of a value type (eg, a composite element), that object will cease to be persistent and its state will be completely removed from the database. Likewise, adding a value type instance to the collection will cause its state to be immediately persistent."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:44(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:68
|
||||
#, no-c-format
|
||||
msgid "On the other hand, if an entity is removed from a collection (a one-to-many or many-to-many association), it will not be deleted, by default. This behaviour is completely consistent - a change to the internal state of another entity should not cause the associated entity to vanish! Likewise, adding an entity to a collection does not cause that entity to become persistent, by default."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:54(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:78
|
||||
#, no-c-format
|
||||
msgid "Instead, the default behaviour is that adding an entity to a collection merely creates a link between the two entities, while removing it removes the link. This is very appropriate for all sorts of cases. Where it is not appropriate at all is the case of a parent / child relationship, where the life of the child is bound to the life cycle of the parent."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:64(title)
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:88
|
||||
#, no-c-format
|
||||
msgid "Bidirectional one-to-many"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:66(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:90
|
||||
#, no-c-format
|
||||
msgid "Suppose we start with a simple <literal><one-to-many></literal> association from <literal>Parent</literal> to <literal>Child</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:76(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:95
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:97
|
||||
#, no-c-format
|
||||
msgid "If we were to execute the following code"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:86(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:101
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = .....;\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.getChildren().add(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:103
|
||||
#, no-c-format
|
||||
msgid "Hibernate would issue two SQL statements:"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:92(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:109
|
||||
#, no-c-format
|
||||
msgid "an <literal>INSERT</literal> to create the record for <literal>c</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:95(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:112
|
||||
#, no-c-format
|
||||
msgid "an <literal>UPDATE</literal> to create the link from <literal>p</literal> to <literal>c</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:102(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:119
|
||||
#, no-c-format
|
||||
msgid "This is not only inefficient, but also violates any <literal>NOT NULL</literal> constraint on the <literal>parent_id</literal> column. We can fix the nullability constraint violation by specifying <literal>not-null=\"true\"</literal> in the collection mapping:"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:113(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:125
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\">\n"
|
||||
" <key column=\"parent_id\" not-null=\"true\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:127
|
||||
#, no-c-format
|
||||
msgid "However, this is not the recommended solution."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:116(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:130
|
||||
#, no-c-format
|
||||
msgid "The underlying cause of this behaviour is that the link (the foreign key <literal>parent_id</literal>) from <literal>p</literal> to <literal>c</literal> is not considered part of the state of the <literal>Child</literal> object and is therefore not created in the <literal>INSERT</literal>. So the solution is to make the link part of the <literal>Child</literal> mapping."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:125(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:137
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[<many-to-one name=\"parent\" column=\"parent_id\" not-null=\"true\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:139
|
||||
#, no-c-format
|
||||
msgid "(We also need to add the <literal>parent</literal> property to the <literal>Child</literal> class.)"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:129(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:143
|
||||
#, no-c-format
|
||||
msgid "Now that the <literal>Child</literal> entity is managing the state of the link, we tell the collection not to update the link. We use the <literal>inverse</literal> attribute."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:139(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:148
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:150
|
||||
#, no-c-format
|
||||
msgid "The following code would be used to add a new <literal>Child</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:150(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:154
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"c.setParent(p);\n"
|
||||
"p.getChildren().add(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:156
|
||||
#, no-c-format
|
||||
msgid "And now, only one SQL <literal>INSERT</literal> would be issued!"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:154(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:160
|
||||
#, no-c-format
|
||||
msgid "To tighten things up a bit, we could create an <literal>addChild()</literal> method of <literal>Parent</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:164(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:165
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public void addChild(Child c) {\n"
|
||||
" c.setParent(this);\n"
|
||||
" children.add(c);\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:167
|
||||
#, no-c-format
|
||||
msgid "Now, the code to add a <literal>Child</literal> looks like"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:177(title)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:171
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.addChild(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:176
|
||||
#, no-c-format
|
||||
msgid "Cascading life cycle"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:179(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:178
|
||||
#, no-c-format
|
||||
msgid "The explicit call to <literal>save()</literal> is still annoying. We will address this by using cascades."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:189(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:183
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\" cascade=\"all\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:185
|
||||
#, no-c-format
|
||||
msgid "This simplifies the code above to"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:198(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:189
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.addChild(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:191
|
||||
#, no-c-format
|
||||
msgid "Similarly, we don't need to iterate over the children when saving or deleting a <literal>Parent</literal>. The following removes <literal>p</literal> and all its children from the database."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:207(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:196
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"session.delete(p);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:198
|
||||
#, no-c-format
|
||||
msgid "However, this code"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:217(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:202
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = (Child) p.getChildren().iterator().next();\n"
|
||||
"p.getChildren().remove(c);\n"
|
||||
"c.setParent(null);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:204
|
||||
#, no-c-format
|
||||
msgid "will not remove <literal>c</literal> from the database; it will ony remove the link to <literal>p</literal> (and cause a <literal>NOT NULL</literal> constraint violation, in this case). You need to explicitly <literal>delete()</literal> the <literal>Child</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:229(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:210
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = (Child) p.getChildren().iterator().next();\n"
|
||||
"p.getChildren().remove(c);\n"
|
||||
"session.delete(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:212
|
||||
#, no-c-format
|
||||
msgid "Now, in our case, a <literal>Child</literal> can't really exist without its parent. So if we remove a <literal>Child</literal> from the collection, we really do want it to be deleted. For this, we must use <literal>cascade=\"all-delete-orphan\"</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:240(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:218
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\" cascade=\"all-delete-orphan\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:220
|
||||
#, no-c-format
|
||||
msgid "Note: even though the collection mapping specifies <literal>inverse=\"true\"</literal>, cascades are still processed by iterating the collection elements. So if you require that an object be saved, deleted or updated by cascade, you must add it to the collection. It is not enough to simply call <literal>setParent()</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:250(title)
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:230
|
||||
#, no-c-format
|
||||
msgid "Cascades and <literal>unsaved-value</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:252(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:232
|
||||
#, no-c-format
|
||||
msgid "Suppose we loaded up a <literal>Parent</literal> in one <literal>Session</literal>, made some changes in a UI action and wish to persist these changes in a new session by calling <literal>update()</literal>. The <literal>Parent</literal> will contain a collection of childen and, since cascading update is enabled, Hibernate needs to know which children are newly instantiated and which represent existing rows in the database. Lets assume that both <literal>Parent</literal> and <literal>Child</literal> have genenerated identifier properties of type <literal>Long</literal>. Hibernate will use the identifier and version/timestamp property value to determine which of the children are new. (See <xref linkend=\"objectstate-saveorupdate\"/>.) <emphasis>In Hibernate3, it is no longer necessary to specify an <literal>unsaved-value</literal> explicitly.</emphasis>"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:264(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:244
|
||||
#, no-c-format
|
||||
msgid "The following code will update <literal>parent</literal> and <literal>child</literal> and insert <literal>newChild</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:276(para)
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:249
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[//parent and child were both loaded in a previous session\n"
|
||||
"parent.addChild(child);\n"
|
||||
"Child newChild = new Child();\n"
|
||||
"parent.addChild(newChild);\n"
|
||||
"session.update(parent);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:251
|
||||
#, no-c-format
|
||||
msgid "Well, that's all very well for the case of a generated identifier, but what about assigned identifiers and composite identifiers? This is more difficult, since Hibernate can't use the identifier property to distinguish between a newly instantiated object (with an identifier assigned by the user) and an object loaded in a previous session. In this case, Hibernate will either use the timestamp or version property, or will actually query the second-level cache or, worst case, the database, to see if the row exists."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:348(title)
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:284
|
||||
#, no-c-format
|
||||
msgid "Conclusion"
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:350(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:286
|
||||
#, no-c-format
|
||||
msgid "There is quite a bit to digest here and it might look confusing first time around. However, in practice, it all works out very nicely. Most Hibernate applications use the parent / child pattern in many places."
|
||||
msgstr ""
|
||||
|
||||
#: example_parentchild.xml:355(para)
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:291
|
||||
#, no-c-format
|
||||
msgid "We mentioned an alternative in the first paragraph. None of the above issues exist in the case of <literal><composite-element></literal> mappings, which have exactly the semantics of a parent / child relationship. Unfortunately, there are two big limitations to composite element classes: composite elements may not own collections, and they should not be the child of any entity other than the unique parent."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: example_parentchild.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,44 +1,478 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:32-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: example_weblog.xml:5(title)
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:29
|
||||
#, no-c-format
|
||||
msgid "Example: Weblog Application"
|
||||
msgstr ""
|
||||
|
||||
#: example_weblog.xml:8(title)
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:32
|
||||
#, no-c-format
|
||||
msgid "Persistent Classes"
|
||||
msgstr ""
|
||||
|
||||
#: example_weblog.xml:10(para)
|
||||
#. Tag: para
|
||||
#: example_weblog.xml:34
|
||||
#, no-c-format
|
||||
msgid "The persistent classes represent a weblog, and an item posted in a weblog. They are to be modelled as a standard parent/child relationship, but we will use an ordered bag, instead of a set."
|
||||
msgstr ""
|
||||
|
||||
#: example_weblog.xml:92(title)
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:40
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.util.List;\n"
|
||||
"\n"
|
||||
"public class Blog {\n"
|
||||
" private Long _id;\n"
|
||||
" private String _name;\n"
|
||||
" private List _items;\n"
|
||||
"\n"
|
||||
" public Long getId() {\n"
|
||||
" return _id;\n"
|
||||
" }\n"
|
||||
" public List getItems() {\n"
|
||||
" return _items;\n"
|
||||
" }\n"
|
||||
" public String getName() {\n"
|
||||
" return _name;\n"
|
||||
" }\n"
|
||||
" public void setId(Long long1) {\n"
|
||||
" _id = long1;\n"
|
||||
" }\n"
|
||||
" public void setItems(List list) {\n"
|
||||
" _items = list;\n"
|
||||
" }\n"
|
||||
" public void setName(String string) {\n"
|
||||
" _name = string;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:42
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.text.DateFormat;\n"
|
||||
"import java.util.Calendar;\n"
|
||||
"\n"
|
||||
"public class BlogItem {\n"
|
||||
" private Long _id;\n"
|
||||
" private Calendar _datetime;\n"
|
||||
" private String _text;\n"
|
||||
" private String _title;\n"
|
||||
" private Blog _blog;\n"
|
||||
"\n"
|
||||
" public Blog getBlog() {\n"
|
||||
" return _blog;\n"
|
||||
" }\n"
|
||||
" public Calendar getDatetime() {\n"
|
||||
" return _datetime;\n"
|
||||
" }\n"
|
||||
" public Long getId() {\n"
|
||||
" return _id;\n"
|
||||
" }\n"
|
||||
" public String getText() {\n"
|
||||
" return _text;\n"
|
||||
" }\n"
|
||||
" public String getTitle() {\n"
|
||||
" return _title;\n"
|
||||
" }\n"
|
||||
" public void setBlog(Blog blog) {\n"
|
||||
" _blog = blog;\n"
|
||||
" }\n"
|
||||
" public void setDatetime(Calendar calendar) {\n"
|
||||
" _datetime = calendar;\n"
|
||||
" }\n"
|
||||
" public void setId(Long long1) {\n"
|
||||
" _id = long1;\n"
|
||||
" }\n"
|
||||
" public void setText(String string) {\n"
|
||||
" _text = string;\n"
|
||||
" }\n"
|
||||
" public void setTitle(String string) {\n"
|
||||
" _title = string;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:47
|
||||
#, no-c-format
|
||||
msgid "Hibernate Mappings"
|
||||
msgstr ""
|
||||
|
||||
#: example_weblog.xml:94(para)
|
||||
#. Tag: para
|
||||
#: example_weblog.xml:49
|
||||
#, no-c-format
|
||||
msgid "The XML mappings should now be quite straightforward."
|
||||
msgstr ""
|
||||
|
||||
#: example_weblog.xml:185(title)
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:53
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE hibernate-mapping PUBLIC\n"
|
||||
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
|
||||
" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
|
||||
"\n"
|
||||
"<hibernate-mapping package=\"eg\">\n"
|
||||
"\n"
|
||||
" <class\n"
|
||||
" name=\"Blog\"\n"
|
||||
" table=\"BLOGS\">\n"
|
||||
"\n"
|
||||
" <id\n"
|
||||
" name=\"id\"\n"
|
||||
" column=\"BLOG_ID\">\n"
|
||||
"\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
"\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"name\"\n"
|
||||
" column=\"NAME\"\n"
|
||||
" not-null=\"true\"\n"
|
||||
" unique=\"true\"/>\n"
|
||||
"\n"
|
||||
" <bag\n"
|
||||
" name=\"items\"\n"
|
||||
" inverse=\"true\"\n"
|
||||
" order-by=\"DATE_TIME\"\n"
|
||||
" cascade=\"all\">\n"
|
||||
"\n"
|
||||
" <key column=\"BLOG_ID\"/>\n"
|
||||
" <one-to-many class=\"BlogItem\"/>\n"
|
||||
"\n"
|
||||
" </bag>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:55
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE hibernate-mapping PUBLIC\n"
|
||||
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
|
||||
" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
|
||||
"\n"
|
||||
"<hibernate-mapping package=\"eg\">\n"
|
||||
"\n"
|
||||
" <class\n"
|
||||
" name=\"BlogItem\"\n"
|
||||
" table=\"BLOG_ITEMS\"\n"
|
||||
" dynamic-update=\"true\">\n"
|
||||
"\n"
|
||||
" <id\n"
|
||||
" name=\"id\"\n"
|
||||
" column=\"BLOG_ITEM_ID\">\n"
|
||||
"\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
"\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"title\"\n"
|
||||
" column=\"TITLE\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"text\"\n"
|
||||
" column=\"TEXT\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"datetime\"\n"
|
||||
" column=\"DATE_TIME\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <many-to-one\n"
|
||||
" name=\"blog\"\n"
|
||||
" column=\"BLOG_ID\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:60
|
||||
#, no-c-format
|
||||
msgid "Hibernate Code"
|
||||
msgstr ""
|
||||
|
||||
#: example_weblog.xml:187(para)
|
||||
#. Tag: para
|
||||
#: example_weblog.xml:62
|
||||
#, no-c-format
|
||||
msgid "The following class demonstrates some of the kinds of things we can do with these classes, using Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: example_weblog.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:67
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.util.ArrayList;\n"
|
||||
"import java.util.Calendar;\n"
|
||||
"import java.util.Iterator;\n"
|
||||
"import java.util.List;\n"
|
||||
"\n"
|
||||
"import org.hibernate.HibernateException;\n"
|
||||
"import org.hibernate.Query;\n"
|
||||
"import org.hibernate.Session;\n"
|
||||
"import org.hibernate.SessionFactory;\n"
|
||||
"import org.hibernate.Transaction;\n"
|
||||
"import org.hibernate.cfg.Configuration;\n"
|
||||
"import org.hibernate.tool.hbm2ddl.SchemaExport;\n"
|
||||
"\n"
|
||||
"public class BlogMain {\n"
|
||||
" \n"
|
||||
" private SessionFactory _sessions;\n"
|
||||
" \n"
|
||||
" public void configure() throws HibernateException {\n"
|
||||
" _sessions = new Configuration()\n"
|
||||
" .addClass(Blog.class)\n"
|
||||
" .addClass(BlogItem.class)\n"
|
||||
" .buildSessionFactory();\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void exportTables() throws HibernateException {\n"
|
||||
" Configuration cfg = new Configuration()\n"
|
||||
" .addClass(Blog.class)\n"
|
||||
" .addClass(BlogItem.class);\n"
|
||||
" new SchemaExport(cfg).create(true, true);\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public Blog createBlog(String name) throws HibernateException {\n"
|
||||
" \n"
|
||||
" Blog blog = new Blog();\n"
|
||||
" blog.setName(name);\n"
|
||||
" blog.setItems( new ArrayList() );\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.persist(blog);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return blog;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public BlogItem createBlogItem(Blog blog, String title, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" BlogItem item = new BlogItem();\n"
|
||||
" item.setTitle(title);\n"
|
||||
" item.setText(text);\n"
|
||||
" item.setBlog(blog);\n"
|
||||
" item.setDatetime( Calendar.getInstance() );\n"
|
||||
" blog.getItems().add(item);\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.update(blog);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return item;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public BlogItem createBlogItem(Long blogid, String title, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" BlogItem item = new BlogItem();\n"
|
||||
" item.setTitle(title);\n"
|
||||
" item.setText(text);\n"
|
||||
" item.setDatetime( Calendar.getInstance() );\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Blog blog = (Blog) session.load(Blog.class, blogid);\n"
|
||||
" item.setBlog(blog);\n"
|
||||
" blog.getItems().add(item);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return item;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void updateBlogItem(BlogItem item, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" item.setText(text);\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.update(item);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void updateBlogItem(Long itemid, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" BlogItem item = (BlogItem) session.load(BlogItem.class, itemid);\n"
|
||||
" item.setText(text);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public List listAllBlogNamesAndItemCounts(int max)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" List result = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"select blog.id, blog.name, count(blogItem) \" +\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"left outer join blog.items as blogItem \" +\n"
|
||||
" \"group by blog.name, blog.id \" +\n"
|
||||
" \"order by max(blogItem.datetime)\"\n"
|
||||
" );\n"
|
||||
" q.setMaxResults(max);\n"
|
||||
" result = q.list();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public Blog getBlogAndAllItems(Long blogid)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" Blog blog = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"left outer join fetch blog.items \" +\n"
|
||||
" \"where blog.id = :blogid\"\n"
|
||||
" );\n"
|
||||
" q.setParameter(\"blogid\", blogid);\n"
|
||||
" blog = (Blog) q.uniqueResult();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return blog;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public List listBlogsAndRecentItems() throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" List result = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"inner join blog.items as blogItem \" +\n"
|
||||
" \"where blogItem.datetime > :minDate\"\n"
|
||||
" );\n"
|
||||
"\n"
|
||||
" Calendar cal = Calendar.getInstance();\n"
|
||||
" cal.roll(Calendar.MONTH, false);\n"
|
||||
" q.setCalendar(\"minDate\", cal);\n"
|
||||
" \n"
|
||||
" result = q.list();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,80 +1,199 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:32-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: filters.xml:5(title)
|
||||
#. Tag: title
|
||||
#: filters.xml:29
|
||||
#, no-c-format
|
||||
msgid "Filtering data"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:7(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:31
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: filters.xml:14(title)
|
||||
#. Tag: title
|
||||
#: filters.xml:38
|
||||
#, no-c-format
|
||||
msgid "Hibernate filters"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:16(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:40
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: filters.xml:26(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:50
|
||||
#, no-c-format
|
||||
msgid "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><filter-def/></literal> element within a <literal><hibernate-mapping/></literal> element:"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:36(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:56
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"myFilter\">\n"
|
||||
" <filter-param name=\"myFilterParam\" type=\"string\"/>\n"
|
||||
"</filter-def>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:58
|
||||
#, no-c-format
|
||||
msgid "Then, this filter can be attached to a class:"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:45(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:62
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"myClass\" ...>\n"
|
||||
" ...\n"
|
||||
" <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:64
|
||||
#, no-c-format
|
||||
msgid "or, to a collection:"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:53(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:68
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set ...>\n"
|
||||
" <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:70
|
||||
#, no-c-format
|
||||
msgid "or, even to both (or multiples of each) at the same time."
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:57(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:74
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: filters.xml:68(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:83
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-value\");]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:85
|
||||
#, no-c-format
|
||||
msgid "Note that methods on the org.hibernate.Filter interface do allow the method-chaining common to much of Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:72(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:89
|
||||
#, no-c-format
|
||||
msgid "A full example, using temporal data with an effective record date pattern:"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:104(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:93
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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-format
|
||||
msgid "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 ""
|
||||
|
||||
#: filters.xml:116(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:100
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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-format
|
||||
msgid "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 ""
|
||||
|
||||
#: filters.xml:122(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:108
|
||||
#, no-c-format
|
||||
msgid "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 ""
|
||||
|
||||
#: filters.xml:129(para)
|
||||
#. Tag: para
|
||||
#: filters.xml:115
|
||||
#, no-c-format
|
||||
msgid "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><filter-def/></literal> allows defining a default condition, either as an attribute or CDATA:"
|
||||
msgstr ""
|
||||
|
||||
#: filters.xml:139(para)
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:122
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![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-format
|
||||
msgid "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 ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: filters.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,280 +1,631 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:32-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: inheritance_mapping.xml:5(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:29
|
||||
#, no-c-format
|
||||
msgid "Inheritance Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:8(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:32
|
||||
#, no-c-format
|
||||
msgid "The Three Strategies"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:10(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:34
|
||||
#, no-c-format
|
||||
msgid "Hibernate supports the three basic inheritance mapping strategies:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:16(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:40
|
||||
#, no-c-format
|
||||
msgid "table per class hierarchy"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:21(para) inheritance_mapping.xml:456(entry)
|
||||
msgid "table per subclass"
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:45
|
||||
#, no-c-format
|
||||
msgid "<para>table per subclass</para>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:26(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:50
|
||||
#, no-c-format
|
||||
msgid "table per concrete class"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:32(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:56
|
||||
#, no-c-format
|
||||
msgid "In addition, Hibernate supports a fourth, slightly different kind of polymorphism:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:39(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:63
|
||||
#, no-c-format
|
||||
msgid "implicit polymorphism"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:45(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:69
|
||||
#, no-c-format
|
||||
msgid "It is possible to use different mapping strategies for different branches of the same inheritance hierarchy, and then make use of implicit polymorphism to achieve polymorphism across the whole hierarchy. However, Hibernate does not support mixing <literal><subclass></literal>, and <literal><joined-subclass></literal> and <literal><union-subclass></literal> mappings under the same root <literal><class></literal> element. It is possible to mix together the table per hierarchy and table per subclass strategies, under the the same <literal><class></literal> element, by combining the <literal><subclass></literal> and <literal><join></literal> elements (see below)."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:59(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:83
|
||||
#, no-c-format
|
||||
msgid "It is possible to define <literal>subclass</literal>, <literal>union-subclass</literal>, and <literal>joined-subclass</literal> mappings in separate mapping documents, directly beneath <literal>hibernate-mapping</literal>. This allows you to extend a class hierachy just by adding a new mapping file. You must specify an <literal>extends</literal> attribute in the subclass mapping, naming a previously mapped superclass. Note: Previously this feature made the ordering of the mapping documents important. Since Hibernate3, the ordering of mapping files does not matter when using the extends keyword. The ordering inside a single mapping file still needs to be defined as superclasses before subclasses."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:79(title)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:94
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
" <hibernate-mapping>\n"
|
||||
" <subclass name=\"DomesticCat\" extends=\"Cat\" discriminator-value=\"D\">\n"
|
||||
" <property name=\"name\" type=\"string\"/>\n"
|
||||
" </subclass>\n"
|
||||
" </hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:98
|
||||
#, no-c-format
|
||||
msgid "Table per class hierarchy"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:81(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:100
|
||||
#, no-c-format
|
||||
msgid "Suppose we have an interface <literal>Payment</literal>, with implementors <literal>CreditCardPayment</literal>, <literal>CashPayment</literal>, <literal>ChequePayment</literal>. The table per hierarchy mapping would look like:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:107(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:107
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Payment\" table=\"PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <discriminator column=\"PAYMENT_TYPE\" type=\"string\"/>\n"
|
||||
" <property name=\"amount\" column=\"AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" <subclass name=\"CreditCardPayment\" discriminator-value=\"CREDIT\">\n"
|
||||
" <property name=\"creditCardType\" column=\"CCTYPE\"/>\n"
|
||||
" ...\n"
|
||||
" </subclass>\n"
|
||||
" <subclass name=\"CashPayment\" discriminator-value=\"CASH\">\n"
|
||||
" ...\n"
|
||||
" </subclass>\n"
|
||||
" <subclass name=\"ChequePayment\" discriminator-value=\"CHEQUE\">\n"
|
||||
" ...\n"
|
||||
" </subclass>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:109
|
||||
#, no-c-format
|
||||
msgid "Exactly one table is required. There is one big limitation of this mapping strategy: columns declared by the subclasses, such as <literal>CCTYPE</literal>, may not have <literal>NOT NULL</literal> constraints."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:116(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:118
|
||||
#, no-c-format
|
||||
msgid "Table per subclass"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:118(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:120
|
||||
#, no-c-format
|
||||
msgid "A table per subclass mapping would look like:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:143(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:124
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Payment\" table=\"PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"amount\" column=\"AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" <joined-subclass name=\"CreditCardPayment\" table=\"CREDIT_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" <property name=\"creditCardType\" column=\"CCTYPE\"/>\n"
|
||||
" ...\n"
|
||||
" </joined-subclass>\n"
|
||||
" <joined-subclass name=\"CashPayment\" table=\"CASH_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" ...\n"
|
||||
" </joined-subclass>\n"
|
||||
" <joined-subclass name=\"ChequePayment\" table=\"CHEQUE_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" ...\n"
|
||||
" </joined-subclass>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:126
|
||||
#, no-c-format
|
||||
msgid "Four tables are required. The three subclass tables have primary key associations to the superclass table (so the relational model is actually a one-to-one association)."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:152(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:135
|
||||
#, no-c-format
|
||||
msgid "Table per subclass, using a discriminator"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:154(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:137
|
||||
#, no-c-format
|
||||
msgid "Note that Hibernate's implementation of table per subclass requires no discriminator column. Other object/relational mappers use a different implementation of table per subclass which requires a type discriminator column in the superclass table. The approach taken by Hibernate is much more difficult to implement but arguably more correct from a relational point of view. If you would like to use a discriminator column with the table per subclass strategy, you may combine the use of <literal><subclass></literal> and <literal><join></literal>, as follow:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:194(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:149
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Payment\" table=\"PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <discriminator column=\"PAYMENT_TYPE\" type=\"string\"/>\n"
|
||||
" <property name=\"amount\" column=\"AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" <subclass name=\"CreditCardPayment\" discriminator-value=\"CREDIT\">\n"
|
||||
" <join table=\"CREDIT_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" <property name=\"creditCardType\" column=\"CCTYPE\"/>\n"
|
||||
" ...\n"
|
||||
" </join>\n"
|
||||
" </subclass>\n"
|
||||
" <subclass name=\"CashPayment\" discriminator-value=\"CASH\">\n"
|
||||
" <join table=\"CASH_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" ...\n"
|
||||
" </join>\n"
|
||||
" </subclass>\n"
|
||||
" <subclass name=\"ChequePayment\" discriminator-value=\"CHEQUE\">\n"
|
||||
" <join table=\"CHEQUE_PAYMENT\" fetch=\"select\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" ...\n"
|
||||
" </join>\n"
|
||||
" </subclass>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:151
|
||||
#, no-c-format
|
||||
msgid "The optional <literal>fetch=\"select\"</literal> declaration tells Hibernate not to fetch the <literal>ChequePayment</literal> subclass data using an outer join when querying the superclass."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:203(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:160
|
||||
#, no-c-format
|
||||
msgid "Mixing table per class hierarchy with table per subclass"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:205(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:162
|
||||
#, no-c-format
|
||||
msgid "You may even mix the table per hierarchy and table per subclass strategies using this approach:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:231(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:167
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Payment\" table=\"PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <discriminator column=\"PAYMENT_TYPE\" type=\"string\"/>\n"
|
||||
" <property name=\"amount\" column=\"AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" <subclass name=\"CreditCardPayment\" discriminator-value=\"CREDIT\">\n"
|
||||
" <join table=\"CREDIT_PAYMENT\">\n"
|
||||
" <property name=\"creditCardType\" column=\"CCTYPE\"/>\n"
|
||||
" ...\n"
|
||||
" </join>\n"
|
||||
" </subclass>\n"
|
||||
" <subclass name=\"CashPayment\" discriminator-value=\"CASH\">\n"
|
||||
" ...\n"
|
||||
" </subclass>\n"
|
||||
" <subclass name=\"ChequePayment\" discriminator-value=\"CHEQUE\">\n"
|
||||
" ...\n"
|
||||
" </subclass>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:169
|
||||
#, no-c-format
|
||||
msgid "For any of these mapping strategies, a polymorphic association to the root <literal>Payment</literal> class is mapped using <literal><many-to-one></literal>."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:242(title)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:175
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[<many-to-one name=\"payment\" column=\"PAYMENT_ID\" class=\"Payment\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:180
|
||||
#, no-c-format
|
||||
msgid "Table per concrete class"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:244(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:182
|
||||
#, no-c-format
|
||||
msgid "There are two ways we could go about mapping the table per concrete class strategy. The first is to use <literal><union-subclass></literal>."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:267(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:187
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Payment\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"PAYMENT_ID\">\n"
|
||||
" <generator class=\"sequence\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"amount\" column=\"AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" <union-subclass name=\"CreditCardPayment\" table=\"CREDIT_PAYMENT\">\n"
|
||||
" <property name=\"creditCardType\" column=\"CCTYPE\"/>\n"
|
||||
" ...\n"
|
||||
" </union-subclass>\n"
|
||||
" <union-subclass name=\"CashPayment\" table=\"CASH_PAYMENT\">\n"
|
||||
" ...\n"
|
||||
" </union-subclass>\n"
|
||||
" <union-subclass name=\"ChequePayment\" table=\"CHEQUE_PAYMENT\">\n"
|
||||
" ...\n"
|
||||
" </union-subclass>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:189
|
||||
#, no-c-format
|
||||
msgid "Three tables are involved for the subclasses. Each table defines columns for all properties of the class, including inherited properties."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:272(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:194
|
||||
#, no-c-format
|
||||
msgid "The limitation of this approach is that if a property is mapped on the superclass, the column name must be the same on all subclass tables. (We might relax this in a future release of Hibernate.) The identity generator strategy is not allowed in union subclass inheritance, indeed the primary key seed has to be shared accross all unioned subclasses of a hierarchy."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:281(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:203
|
||||
#, no-c-format
|
||||
msgid "If your superclass is abstract, map it with <literal>abstract=\"true\"</literal>. Of course, if it is not abstract, an additional table (defaults to <literal>PAYMENT</literal> in the example above) is needed to hold instances of the superclass."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:291(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:213
|
||||
#, no-c-format
|
||||
msgid "Table per concrete class, using implicit polymorphism"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:293(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:215
|
||||
#, no-c-format
|
||||
msgid "An alternative approach is to make use of implicit polymorphism:"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:321(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:219
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"CreditCardPayment\" table=\"CREDIT_PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"CREDIT_PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"amount\" column=\"CREDIT_AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"CashPayment\" table=\"CASH_PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"CASH_PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"amount\" column=\"CASH_AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"ChequePayment\" table=\"CHEQUE_PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"CHEQUE_PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"amount\" column=\"CHEQUE_AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:221
|
||||
#, no-c-format
|
||||
msgid "Notice that nowhere do we mention the <literal>Payment</literal> interface explicitly. Also notice that properties of <literal>Payment</literal> are mapped in each of the subclasses. If you want to avoid duplication, consider using XML entities (e.g. <literal>[ <!ENTITY allproperties SYSTEM \"allproperties.xml\"> ]</literal> in the <literal>DOCTYPE</literal> declartion and <literal>&allproperties;</literal> in the mapping)."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:331(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:231
|
||||
#, no-c-format
|
||||
msgid "The disadvantage of this approach is that Hibernate does not generate SQL <literal>UNION</literal>s when performing polymorphic queries."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:336(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:236
|
||||
#, no-c-format
|
||||
msgid "For this mapping strategy, a polymorphic association to <literal>Payment</literal> is usually mapped using <literal><any></literal>."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:352(title)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:241
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<any name=\"payment\" meta-type=\"string\" id-type=\"long\">\n"
|
||||
" <meta-value value=\"CREDIT\" class=\"CreditCardPayment\"/>\n"
|
||||
" <meta-value value=\"CASH\" class=\"CashPayment\"/>\n"
|
||||
" <meta-value value=\"CHEQUE\" class=\"ChequePayment\"/>\n"
|
||||
" <column name=\"PAYMENT_CLASS\"/>\n"
|
||||
" <column name=\"PAYMENT_ID\"/>\n"
|
||||
"</any>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:246
|
||||
#, no-c-format
|
||||
msgid "Mixing implicit polymorphism with other inheritance mappings"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:354(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:248
|
||||
#, no-c-format
|
||||
msgid "There is one further thing to notice about this mapping. Since the subclasses are each mapped in their own <literal><class></literal> element (and since <literal>Payment</literal> is just an interface), each of the subclasses could easily be part of another inheritance hierarchy! (And you can still use polymorphic queries against the <literal>Payment</literal> interface.)"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:390(para)
|
||||
#. Tag: programlisting
|
||||
#: inheritance_mapping.xml:256
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"CreditCardPayment\" table=\"CREDIT_PAYMENT\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"CREDIT_PAYMENT_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" <discriminator column=\"CREDIT_CARD\" type=\"string\"/>\n"
|
||||
" <property name=\"amount\" column=\"CREDIT_AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" <subclass name=\"MasterCardPayment\" discriminator-value=\"MDC\"/>\n"
|
||||
" <subclass name=\"VisaPayment\" discriminator-value=\"VISA\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"NonelectronicTransaction\" table=\"NONELECTRONIC_TXN\">\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"TXN_ID\">\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
" </id>\n"
|
||||
" ...\n"
|
||||
" <joined-subclass name=\"CashPayment\" table=\"CASH_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" <property name=\"amount\" column=\"CASH_AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" </joined-subclass>\n"
|
||||
" <joined-subclass name=\"ChequePayment\" table=\"CHEQUE_PAYMENT\">\n"
|
||||
" <key column=\"PAYMENT_ID\"/>\n"
|
||||
" <property name=\"amount\" column=\"CHEQUE_AMOUNT\"/>\n"
|
||||
" ...\n"
|
||||
" </joined-subclass>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:258
|
||||
#, no-c-format
|
||||
msgid "Once again, we don't mention <literal>Payment</literal> explicitly. If we execute a query against the <literal>Payment</literal> interface - for example, <literal>from Payment</literal> - Hibernate automatically returns instances of <literal>CreditCardPayment</literal> (and its subclasses, since they also implement <literal>Payment</literal>), <literal>CashPayment</literal> and <literal>ChequePayment</literal> but not instances of <literal>NonelectronicTransaction</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:405(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:273
|
||||
#, no-c-format
|
||||
msgid "Limitations"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:407(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:275
|
||||
#, no-c-format
|
||||
msgid "There are certain limitations to the \"implicit polymorphism\" approach to the table per concrete-class mapping strategy. There are somewhat less restrictive limitations to <literal><union-subclass></literal> mappings."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:414(para)
|
||||
#. Tag: para
|
||||
#: inheritance_mapping.xml:282
|
||||
#, no-c-format
|
||||
msgid "The following table shows the limitations of table per concrete-class mappings, and of implicit polymorphism, in Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:420(title)
|
||||
#. Tag: title
|
||||
#: inheritance_mapping.xml:288
|
||||
#, no-c-format
|
||||
msgid "Features of inheritance mappings"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:432(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:300
|
||||
#, no-c-format
|
||||
msgid "Inheritance strategy"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:433(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:301
|
||||
#, no-c-format
|
||||
msgid "Polymorphic many-to-one"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:434(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:302
|
||||
#, no-c-format
|
||||
msgid "Polymorphic one-to-one"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:435(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:303
|
||||
#, no-c-format
|
||||
msgid "Polymorphic one-to-many"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:436(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:304
|
||||
#, no-c-format
|
||||
msgid "Polymorphic many-to-many"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:437(literal)
|
||||
msgid "load()/get()"
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:305
|
||||
#, no-c-format
|
||||
msgid "Polymorphic <literal>load()/get()</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:437(entry)
|
||||
msgid "Polymorphic <placeholder-1/>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:438(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:306
|
||||
#, no-c-format
|
||||
msgid "Polymorphic queries"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:439(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:307
|
||||
#, no-c-format
|
||||
msgid "Polymorphic joins"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:440(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:308
|
||||
#, no-c-format
|
||||
msgid "Outer join fetching"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:445(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:313
|
||||
#, no-c-format
|
||||
msgid "table per class-hierarchy"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:446(literal) inheritance_mapping.xml:457(literal) inheritance_mapping.xml:468(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:314 inheritance_mapping.xml:325 inheritance_mapping.xml:336
|
||||
#, no-c-format
|
||||
msgid "<many-to-one>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:447(literal) inheritance_mapping.xml:458(literal) inheritance_mapping.xml:469(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:315 inheritance_mapping.xml:326 inheritance_mapping.xml:337
|
||||
#, no-c-format
|
||||
msgid "<one-to-one>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:448(literal) inheritance_mapping.xml:459(literal) inheritance_mapping.xml:470(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:316 inheritance_mapping.xml:327
|
||||
#, no-c-format
|
||||
msgid "<one-to-many>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:449(literal) inheritance_mapping.xml:460(literal) inheritance_mapping.xml:471(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:317 inheritance_mapping.xml:328 inheritance_mapping.xml:339
|
||||
#, no-c-format
|
||||
msgid "<many-to-many>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:450(literal) inheritance_mapping.xml:461(literal) inheritance_mapping.xml:472(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:318 inheritance_mapping.xml:329 inheritance_mapping.xml:340
|
||||
#, no-c-format
|
||||
msgid "s.get(Payment.class, id)"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:451(literal) inheritance_mapping.xml:462(literal) inheritance_mapping.xml:473(literal) inheritance_mapping.xml:484(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:319 inheritance_mapping.xml:330 inheritance_mapping.xml:341 inheritance_mapping.xml:352
|
||||
#, no-c-format
|
||||
msgid "from Payment p"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:452(literal) inheritance_mapping.xml:463(literal) inheritance_mapping.xml:474(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:320 inheritance_mapping.xml:331 inheritance_mapping.xml:342
|
||||
#, no-c-format
|
||||
msgid "from Order o join o.payment p"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:453(emphasis) inheritance_mapping.xml:464(emphasis) inheritance_mapping.xml:475(emphasis)
|
||||
#. Tag: emphasis
|
||||
#: inheritance_mapping.xml:321 inheritance_mapping.xml:332 inheritance_mapping.xml:343
|
||||
#, no-c-format
|
||||
msgid "supported"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:467(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:324
|
||||
#, no-c-format
|
||||
msgid "<entry>table per subclass</entry>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:335
|
||||
#, no-c-format
|
||||
msgid "table per concrete-class (union-subclass)"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:470(literal)
|
||||
msgid "inverse=\"true\""
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:338
|
||||
#, no-c-format
|
||||
msgid "<literal><one-to-many></literal> (for <literal>inverse=\"true\"</literal> only)"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:470(entry)
|
||||
msgid "<placeholder-1/> (for <placeholder-2/> only)"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:478(entry)
|
||||
#. Tag: entry
|
||||
#: inheritance_mapping.xml:346
|
||||
#, no-c-format
|
||||
msgid "table per concrete class (implicit polymorphism)"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:479(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:347
|
||||
#, no-c-format
|
||||
msgid "<any>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:480(emphasis) inheritance_mapping.xml:481(emphasis) inheritance_mapping.xml:485(emphasis) inheritance_mapping.xml:486(emphasis)
|
||||
#. Tag: emphasis
|
||||
#: inheritance_mapping.xml:348 inheritance_mapping.xml:349 inheritance_mapping.xml:353 inheritance_mapping.xml:354
|
||||
#, no-c-format
|
||||
msgid "not supported"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:482(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:350
|
||||
#, no-c-format
|
||||
msgid "<many-to-any>"
|
||||
msgstr ""
|
||||
|
||||
#: inheritance_mapping.xml:483(literal)
|
||||
#. Tag: literal
|
||||
#: inheritance_mapping.xml:351
|
||||
#, no-c-format
|
||||
msgid "s.createCriteria(Payment.class).add( Restrictions.idEq(id) ).uniqueResult()"
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: inheritance_mapping.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,208 +1,566 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:33-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: persistent_classes.xml:5(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:29
|
||||
#, no-c-format
|
||||
msgid "Persistent Classes"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:7(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:31
|
||||
#, no-c-format
|
||||
msgid "Persistent classes are classes in an application that implement the entities of the business problem (e.g. Customer and Order in an E-commerce application). Not all instances of a persistent class are considered to be in the persistent state - an instance may instead be transient or detached."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:14(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:38
|
||||
#, no-c-format
|
||||
msgid "Hibernate works best if these classes follow some simple rules, also known as the Plain Old Java Object (POJO) programming model. However, none of these rules are hard requirements. Indeed, Hibernate3 assumes very little about the nature of your persistent objects. You may express a domain model in other ways: using trees of <literal>Map</literal> instances, for example."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:23(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:47
|
||||
#, no-c-format
|
||||
msgid "A simple POJO example"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:25(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:49
|
||||
#, no-c-format
|
||||
msgid "Most Java applications require a persistent class representing felines."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:108(para)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:53
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"import java.util.Set;\n"
|
||||
"import java.util.Date;\n"
|
||||
"\n"
|
||||
"public class Cat {\n"
|
||||
" private Long id; // identifier\n"
|
||||
"\n"
|
||||
" private Date birthdate;\n"
|
||||
" private Color color;\n"
|
||||
" private char sex;\n"
|
||||
" private float weight;\n"
|
||||
" private int litterId;\n"
|
||||
"\n"
|
||||
" private Cat mother;\n"
|
||||
" private Set kittens = new HashSet();\n"
|
||||
"\n"
|
||||
" private void setId(Long id) {\n"
|
||||
" this.id=id;\n"
|
||||
" }\n"
|
||||
" public Long getId() {\n"
|
||||
" return id;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void setBirthdate(Date date) {\n"
|
||||
" birthdate = date;\n"
|
||||
" }\n"
|
||||
" public Date getBirthdate() {\n"
|
||||
" return birthdate;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void setWeight(float weight) {\n"
|
||||
" this.weight = weight;\n"
|
||||
" }\n"
|
||||
" public float getWeight() {\n"
|
||||
" return weight;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public Color getColor() {\n"
|
||||
" return color;\n"
|
||||
" }\n"
|
||||
" void setColor(Color color) {\n"
|
||||
" this.color = color;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void setSex(char sex) {\n"
|
||||
" this.sex=sex;\n"
|
||||
" }\n"
|
||||
" public char getSex() {\n"
|
||||
" return sex;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void setLitterId(int id) {\n"
|
||||
" this.litterId = id;\n"
|
||||
" }\n"
|
||||
" public int getLitterId() {\n"
|
||||
" return litterId;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" void setMother(Cat mother) {\n"
|
||||
" this.mother = mother;\n"
|
||||
" }\n"
|
||||
" public Cat getMother() {\n"
|
||||
" return mother;\n"
|
||||
" }\n"
|
||||
" void setKittens(Set kittens) {\n"
|
||||
" this.kittens = kittens;\n"
|
||||
" }\n"
|
||||
" public Set getKittens() {\n"
|
||||
" return kittens;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" // addKitten not needed by Hibernate\n"
|
||||
" public void addKitten(Cat kitten) {\n"
|
||||
" kitten.setMother(this);\n"
|
||||
" kitten.setLitterId( kittens.size() ); \n"
|
||||
" kittens.add(kitten);\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:55
|
||||
#, no-c-format
|
||||
msgid "There are four main rules to follow here:"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:114(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:61
|
||||
#, no-c-format
|
||||
msgid "Implement a no-argument constructor"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:116(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:63
|
||||
#, no-c-format
|
||||
msgid "<literal>Cat</literal> has a no-argument constructor. All persistent classes must have a default constructor (which may be non-public) so that Hibernate can instantiate them using <literal>Constructor.newInstance()</literal>. We strongly recommend having a default constructor with at least <emphasis>package</emphasis> visibility for runtime proxy generation in Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:126(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:73
|
||||
#, no-c-format
|
||||
msgid "Provide an identifier property (optional)"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:128(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:75
|
||||
#, no-c-format
|
||||
msgid "<literal>Cat</literal> has a property called <literal>id</literal>. This property maps to the primary key column of a database table. The property might have been called anything, and its type might have been any primitive type, any primitive \"wrapper\" type, <literal>java.lang.String</literal> or <literal>java.util.Date</literal>. (If your legacy database table has composite keys, you can even use a user-defined class with properties of these types - see the section on composite identifiers later.)"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:137(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:84
|
||||
#, no-c-format
|
||||
msgid "The identifier property is strictly optional. You can leave them off and let Hibernate keep track of object identifiers internally. We do not recommend this, however."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:142(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:89
|
||||
#, no-c-format
|
||||
msgid "In fact, some functionality is available only to classes which declare an identifier property:"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:149(para)
|
||||
msgid "Transitive reattachment for detached objects (cascade update or cascade merge) - see <xref linkend=\"objectstate-transitive\"/>"
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:96
|
||||
#, no-c-format
|
||||
msgid "Transitive reattachment for detached objects (cascade update or cascade merge) - see"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:156(literal)
|
||||
#. Tag: literal
|
||||
#: persistent_classes.xml:103
|
||||
#, no-c-format
|
||||
msgid "Session.saveOrUpdate()"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:161(literal)
|
||||
#. Tag: literal
|
||||
#: persistent_classes.xml:108
|
||||
#, no-c-format
|
||||
msgid "Session.merge()"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:166(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:113
|
||||
#, no-c-format
|
||||
msgid "We recommend you declare consistently-named identifier properties on persistent classes. We further recommend that you use a nullable (ie. non-primitive) type."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:173(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:120
|
||||
#, no-c-format
|
||||
msgid "Prefer non-final classes (optional)"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:174(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:121
|
||||
#, no-c-format
|
||||
msgid "A central feature of Hibernate, <emphasis>proxies</emphasis>, depends upon the persistent class being either non-final, or the implementation of an interface that declares all public methods."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:179(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:126
|
||||
#, no-c-format
|
||||
msgid "You can persist <literal>final</literal> classes that do not implement an interface with Hibernate, but you won't be able to use proxies for lazy association fetching - which will limit your options for performance tuning."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:184(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:131
|
||||
#, no-c-format
|
||||
msgid "You should also avoid declaring <literal>public final</literal> methods on the non-final classes. If you want to use a class with a <literal>public final</literal> method, you must explicitly disable proxying by setting <literal>lazy=\"false\"</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:192(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:139
|
||||
#, no-c-format
|
||||
msgid "Declare accessors and mutators for persistent fields (optional)"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:194(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:141
|
||||
#, no-c-format
|
||||
msgid "<literal>Cat</literal> declares accessor methods for all its persistent fields. Many other ORM tools directly persist instance variables. We believe it is better to provide an indirection between the relational schema and internal data structures of the class. By default, Hibernate persists JavaBeans style properties, and recognizes method names of the form <literal>getFoo</literal>, <literal>isFoo</literal> and <literal>setFoo</literal>. You may switch to direct field access for particular properties, if needed."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:204(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:151
|
||||
#, no-c-format
|
||||
msgid "Properties need <emphasis>not</emphasis> be declared public - Hibernate can persist a property with a default, <literal>protected</literal> or <literal>private</literal> get / set pair."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:215(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:162
|
||||
#, no-c-format
|
||||
msgid "Implementing inheritance"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:217(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:164
|
||||
#, no-c-format
|
||||
msgid "A subclass must also observe the first and second rules. It inherits its identifier property from the superclass, <literal>Cat</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:237(title)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:169
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"public class DomesticCat extends Cat {\n"
|
||||
" private String name;\n"
|
||||
"\n"
|
||||
" public String getName() {\n"
|
||||
" return name;\n"
|
||||
" }\n"
|
||||
" protected void setName(String name) {\n"
|
||||
" this.name=name;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:173
|
||||
#, no-c-format
|
||||
msgid "Implementing <literal>equals()</literal> and <literal>hashCode()</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:239(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:175
|
||||
#, no-c-format
|
||||
msgid "You have to override the <literal>equals()</literal> and <literal>hashCode()</literal> methods if you"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:245(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:181
|
||||
#, no-c-format
|
||||
msgid "intend to put instances of persistent classes in a <literal>Set</literal> (the recommended way to represent many-valued associations) <emphasis>and</emphasis>"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:252(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:188
|
||||
#, no-c-format
|
||||
msgid "intend to use reattachment of detached instances"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:258(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:194
|
||||
#, no-c-format
|
||||
msgid "Hibernate guarantees equivalence of persistent identity (database row) and Java identity only inside a particular session scope. So as soon as we mix instances retrieved in different sessions, we must implement <literal>equals()</literal> and <literal>hashCode()</literal> if we wish to have meaningful semantics for <literal>Set</literal>s."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:266(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:202
|
||||
#, no-c-format
|
||||
msgid "The most obvious way is to implement <literal>equals()</literal>/<literal>hashCode()</literal> by comparing the identifier value of both objects. If the value is the same, both must be the same database row, they are therefore equal (if both are added to a <literal>Set</literal>, we will only have one element in the <literal>Set</literal>). Unfortunately, we can't use that approach with generated identifiers! Hibernate will only assign identifier values to objects that are persistent, a newly created instance will not have any identifier value! Furthermore, if an instance is unsaved and currently in a <literal>Set</literal>, saving it will assign an identifier value to the object. If <literal>equals()</literal> and <literal>hashCode()</literal> are based on the identifier value, the hash code would change, breaking the contract of the <literal>Set</literal>. See the Hibernate website for a full discussion of this problem. Note that this is not a Hibernate issue, but normal Java semantics of object identity and equality."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:280(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:216
|
||||
#, no-c-format
|
||||
msgid "We recommend implementing <literal>equals()</literal> and <literal>hashCode()</literal> using <emphasis>Business key equality</emphasis>. Business key equality means that the <literal>equals()</literal> method compares only the properties that form the business key, a key that would identify our instance in the real world (a <emphasis>natural</emphasis> candidate key):"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:312(para)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:224
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class Cat {\n"
|
||||
"\n"
|
||||
" ...\n"
|
||||
" public boolean equals(Object other) {\n"
|
||||
" if (this == other) return true;\n"
|
||||
" if ( !(other instanceof Cat) ) return false;\n"
|
||||
"\n"
|
||||
" final Cat cat = (Cat) other;\n"
|
||||
"\n"
|
||||
" if ( !cat.getLitterId().equals( getLitterId() ) ) return false;\n"
|
||||
" if ( !cat.getMother().equals( getMother() ) ) return false;\n"
|
||||
"\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public int hashCode() {\n"
|
||||
" int result;\n"
|
||||
" result = getMother().hashCode();\n"
|
||||
" result = 29 * result + getLitterId();\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:226
|
||||
#, no-c-format
|
||||
msgid "Note that a business key does not have to be as solid as a database primary key candidate (see <xref linkend=\"transactions-basics-identity\"/>). Immutable or unique properties are usually good candidates for a business key."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:322(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:236
|
||||
#, no-c-format
|
||||
msgid "Dynamic models"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:325(emphasis)
|
||||
#. Tag: emphasis
|
||||
#: persistent_classes.xml:239
|
||||
#, no-c-format
|
||||
msgid "Note that the following features are currently considered experimental and may change in the near future."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:329(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:243
|
||||
#, no-c-format
|
||||
msgid "Persistent entities don't necessarily have to be represented as POJO classes or as JavaBean objects at runtime. Hibernate also supports dynamic models (using <literal>Map</literal>s of <literal>Map</literal>s at runtime) and the representation of entities as DOM4J trees. With this approach, you don't write persistent classes, only mapping files."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:337(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:251
|
||||
#, no-c-format
|
||||
msgid "By default, Hibernate works in normal POJO mode. You may set a default entity representation mode for a particular <literal>SessionFactory</literal> using the <literal>default_entity_mode</literal> configuration option (see <xref linkend=\"configuration-optional-properties\"/>."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:344(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:258
|
||||
#, no-c-format
|
||||
msgid "The following examples demonstrates the representation using <literal>Map</literal>s. First, in the mapping file, an <literal>entity-name</literal> has to be declared instead of (or in addition to) a class name:"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:384(para)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:264
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-mapping>\n"
|
||||
"\n"
|
||||
" <class entity-name=\"Customer\">\n"
|
||||
"\n"
|
||||
" <id name=\"id\"\n"
|
||||
" type=\"long\"\n"
|
||||
" column=\"ID\">\n"
|
||||
" <generator class=\"sequence\"/>\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property name=\"name\"\n"
|
||||
" column=\"NAME\"\n"
|
||||
" type=\"string\"/>\n"
|
||||
"\n"
|
||||
" <property name=\"address\"\n"
|
||||
" column=\"ADDRESS\"\n"
|
||||
" type=\"string\"/>\n"
|
||||
"\n"
|
||||
" <many-to-one name=\"organization\"\n"
|
||||
" column=\"ORGANIZATION_ID\"\n"
|
||||
" class=\"Organization\"/>\n"
|
||||
"\n"
|
||||
" <bag name=\"orders\"\n"
|
||||
" inverse=\"true\"\n"
|
||||
" lazy=\"false\"\n"
|
||||
" cascade=\"all\">\n"
|
||||
" <key column=\"CUSTOMER_ID\"/>\n"
|
||||
" <one-to-many class=\"Order\"/>\n"
|
||||
" </bag>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
" \n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:266
|
||||
#, no-c-format
|
||||
msgid "Note that even though associations are declared using target class names, the target type of an associations may also be a dynamic entity instead of a POJO."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:391(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:273
|
||||
#, no-c-format
|
||||
msgid "After setting the default entity mode to <literal>dynamic-map</literal> for the <literal>SessionFactory</literal>, we can at runtime work with <literal>Map</literal>s of <literal>Map</literal>s:"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:419(para)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:279
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session s = openSession();\n"
|
||||
"Transaction tx = s.beginTransaction();\n"
|
||||
"Session s = openSession();\n"
|
||||
"\n"
|
||||
"// Create a customer\n"
|
||||
"Map david = new HashMap();\n"
|
||||
"david.put(\"name\", \"David\");\n"
|
||||
"\n"
|
||||
"// Create an organization\n"
|
||||
"Map foobar = new HashMap();\n"
|
||||
"foobar.put(\"name\", \"Foobar Inc.\");\n"
|
||||
"\n"
|
||||
"// Link both\n"
|
||||
"david.put(\"organization\", foobar);\n"
|
||||
"\n"
|
||||
"// Save both\n"
|
||||
"s.save(\"Customer\", david);\n"
|
||||
"s.save(\"Organization\", foobar);\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"s.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:281
|
||||
#, no-c-format
|
||||
msgid "The advantages of a dynamic mapping are quick turnaround time for prototyping without the need for entity class implementation. However, you lose compile-time type checking and will very likely deal with many exceptions at runtime. Thanks to the Hibernate mapping, the database schema can easily be normalized and sound, allowing to add a proper domain model implementation on top later on."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:427(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:289
|
||||
#, no-c-format
|
||||
msgid "Entity representation modes can also be set on a per <literal>Session</literal> basis:"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:446(para)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:294
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session dynamicSession = pojoSession.getSession(EntityMode.MAP);\n"
|
||||
"\n"
|
||||
"// Create a customer\n"
|
||||
"Map david = new HashMap();\n"
|
||||
"david.put(\"name\", \"David\");\n"
|
||||
"dynamicSession.save(\"Customer\", david);\n"
|
||||
"...\n"
|
||||
"dynamicSession.flush();\n"
|
||||
"dynamicSession.close()\n"
|
||||
"...\n"
|
||||
"// Continue on pojoSession\n"
|
||||
"]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:297
|
||||
#, no-c-format
|
||||
msgid "Please note that the call to <literal>getSession()</literal> using an <literal>EntityMode</literal> is on the <literal>Session</literal> API, not the <literal>SessionFactory</literal>. That way, the new <literal>Session</literal> shares the underlying JDBC connection, transaction, and other context information. This means you don't have tocall <literal>flush()</literal> and <literal>close()</literal> on the secondary <literal>Session</literal>, and also leave the transaction and connection handling to the primary unit of work."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:456(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:307
|
||||
#, no-c-format
|
||||
msgid "More information about the XML representation capabilities can be found in <xref linkend=\"xml\"/>."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:464(title)
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:315
|
||||
#, no-c-format
|
||||
msgid "Tuplizers"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:466(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:317
|
||||
#, no-c-format
|
||||
msgid "<literal>org.hibernate.tuple.Tuplizer</literal>, and its sub-interfaces, are responsible for managing a particular representation of a piece of data, given that representation's <literal>org.hibernate.EntityMode</literal>. If a given piece of data is thought of as a data structure, then a tuplizer is the thing which knows how to create such a data structure and how to extract values from and inject values into such a data structure. For example, for the POJO entity mode, the correpsonding tuplizer knows how create the POJO through its constructor and how to access the POJO properties using the defined property accessors. There are two high-level types of Tuplizers, represented by the <literal>org.hibernate.tuple.entity.EntityTuplizer</literal> and <literal>org.hibernate.tuple.component.ComponentTuplizer</literal> interfaces. <literal>EntityTuplizer</literal>s are responsible for managing the above mentioned contracts in regards to entities, while <literal>ComponentTuplizer</literal>s do the same for components."
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:481(para)
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:332
|
||||
#, no-c-format
|
||||
msgid "Users may also plug in their own tuplizers. Perhaps you require that a <literal>java.util.Map</literal> implementation other than <literal>java.util.HashMap</literal> be used while in the dynamic-map entity-mode; or perhaps you need to define a different proxy generation strategy than the one used by default. Both would be achieved by defining a custom tuplizer implementation. Tuplizers definitions are attached to the entity or component mapping they are meant to manage. Going back to the example of our customer entity:"
|
||||
msgstr ""
|
||||
|
||||
#: persistent_classes.xml:529(para)
|
||||
#. Tag: programlisting
|
||||
#: persistent_classes.xml:341
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-mapping>\n"
|
||||
" <class entity-name=\"Customer\">\n"
|
||||
" <!--\n"
|
||||
" Override the dynamic-map entity-mode\n"
|
||||
" tuplizer for the customer entity\n"
|
||||
" -->\n"
|
||||
" <tuplizer entity-mode=\"dynamic-map\"\n"
|
||||
" class=\"CustomMapTuplizerImpl\"/>\n"
|
||||
"\n"
|
||||
" <id name=\"id\" type=\"long\" column=\"ID\">\n"
|
||||
" <generator class=\"sequence\"/>\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <!-- other properties -->\n"
|
||||
" ...\n"
|
||||
" </class>\n"
|
||||
"</hibernate-mapping>\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"public class CustomMapTuplizerImpl\n"
|
||||
" extends org.hibernate.tuple.entity.DynamicMapEntityTuplizer {\n"
|
||||
" // override the buildInstantiator() method to plug in our custom map...\n"
|
||||
" protected final Instantiator buildInstantiator(\n"
|
||||
" org.hibernate.mapping.PersistentClass mappingInfo) {\n"
|
||||
" return new CustomMapInstantiator( mappingInfo );\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" private static final class CustomMapInstantiator\n"
|
||||
" extends org.hibernate.tuple.DynamicMapInstantitor {\n"
|
||||
" // override the generateMap() method to return our custom map...\n"
|
||||
" protected final Map generateMap() {\n"
|
||||
" return new CustomMap();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: persistent_classes.xml:347
|
||||
#, no-c-format
|
||||
msgid "Extentsions"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: persistent_classes.xml:348
|
||||
#, no-c-format
|
||||
msgid "TODO: Document user-extension framework in the property and proxy packages"
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: persistent_classes.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,72 +1,100 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:33-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: preface.xml:21(title)
|
||||
#. Tag: title
|
||||
#: preface.xml:29
|
||||
#, no-c-format
|
||||
msgid "Preface"
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:23(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:31
|
||||
#, no-c-format
|
||||
msgid "Working with object-oriented software and a relational database can be cumbersome and time consuming in today's enterprise environments. Hibernate is an object/relational mapping tool for Java environments. The term object/relational mapping (ORM) refers to the technique of mapping a data representation from an object model to a relational data model with a SQL-based schema."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:31(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:39
|
||||
#, no-c-format
|
||||
msgid "Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:38(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:46
|
||||
#, no-c-format
|
||||
msgid "Hibernates goal is to relieve the developer from 95 percent of common data persistence related programming tasks. Hibernate may not be the best solution for data-centric applications that only use stored-procedures to implement the business logic in the database, it is most useful with object-oriented domain models and business logic in the Java-based middle-tier. However, Hibernate can certainly help you to remove or encapsulate vendor-specific SQL code and will help with the common task of result set translation from a tabular representation to a graph of objects."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:48(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:56
|
||||
#, no-c-format
|
||||
msgid "If you are new to Hibernate and Object/Relational Mapping or even Java, please follow these steps:"
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:55(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:63
|
||||
#, no-c-format
|
||||
msgid "Read <xref linkend=\"tutorial\"/> for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the <literal>doc/reference/tutorial/</literal> directory."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:63(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:71
|
||||
#, no-c-format
|
||||
msgid "Read <xref linkend=\"architecture\"/> to understand the environments where Hibernate can be used."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:69(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:77
|
||||
#, no-c-format
|
||||
msgid "Have a look at the <literal>eg/</literal> directory in the Hibernate distribution, it contains a simple standalone application. Copy your JDBC driver to the <literal>lib/</literal> directory and edit <literal>etc/hibernate.properties</literal>, specifying correct values for your database. From a command prompt in the distribution directory, type <literal>ant eg</literal> (using Ant), or under Windows, type <literal>build eg</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:80(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:88
|
||||
#, no-c-format
|
||||
msgid "Use this reference documentation as your primary source of information. Consider reading <emphasis>Java Persistence with Hibernate</emphasis> (http://www.manning.com/bauer2) if you need more help with application design or if you prefer a step-by-step tutorial. Also visit http://caveatemptor.hibernate.org and download the example application for Java Persistence with Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:90(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:98
|
||||
#, no-c-format
|
||||
msgid "FAQs are answered on the Hibernate website."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:95(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:103
|
||||
#, no-c-format
|
||||
msgid "Third party demos, examples, and tutorials are linked on the Hibernate website."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:101(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:109
|
||||
#, no-c-format
|
||||
msgid "The Community Area on the Hibernate website is a good resource for design patterns and various integration solutions (Tomcat, JBoss AS, Struts, EJB, etc.)."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:109(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:117
|
||||
#, no-c-format
|
||||
msgid "If you have questions, use the user forum linked on the Hibernate website. We also provide a JIRA issue trackings system for bug reports and feature requests. If you are interested in the development of Hibernate, join the developer mailing list. If you are interested in translating this documentation into your language, contact us on the developer mailing list."
|
||||
msgstr ""
|
||||
|
||||
#: preface.xml:117(para)
|
||||
#. Tag: para
|
||||
#: preface.xml:125
|
||||
#, no-c-format
|
||||
msgid "Commercial development support, production support, and training for Hibernate is available through JBoss Inc. (see http://www.hibernate.org/SupportTraining/). Hibernate is a Professional Open Source project and a critical component of the JBoss Enterprise Middleware System (JEMS) suite of products."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: preface.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,184 +1,630 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:33-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: query_criteria.xml:5(title)
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:29
|
||||
#, no-c-format
|
||||
msgid "Criteria Queries"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:7(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:31
|
||||
#, no-c-format
|
||||
msgid "Hibernate features an intuitive, extensible criteria query API."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:12(title)
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:36
|
||||
#, no-c-format
|
||||
msgid "Creating a <literal>Criteria</literal> instance"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:14(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:38
|
||||
#, no-c-format
|
||||
msgid "The interface <literal>org.hibernate.Criteria</literal> represents a query against a particular persistent class. The <literal>Session</literal> is a factory for <literal>Criteria</literal> instances."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:27(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:44
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Criteria crit = sess.createCriteria(Cat.class);\n"
|
||||
"crit.setMaxResults(50);\n"
|
||||
"List cats = crit.list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:49
|
||||
#, no-c-format
|
||||
msgid "Narrowing the result set"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:29(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:51
|
||||
#, no-c-format
|
||||
msgid "An individual query criterion is an instance of the interface <literal>org.hibernate.criterion.Criterion</literal>. The class <literal>org.hibernate.criterion.Restrictions</literal> defines factory methods for obtaining certain built-in <literal>Criterion</literal> types."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:42(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:59
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
|
||||
" .add( Restrictions.between(\"weight\", minWeight, maxWeight) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:61
|
||||
#, no-c-format
|
||||
msgid "Restrictions may be grouped logically."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:64(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:65
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
|
||||
" .add( Restrictions.or(\n"
|
||||
" Restrictions.eq( \"age\", new Integer(0) ),\n"
|
||||
" Restrictions.isNull(\"age\")\n"
|
||||
" ) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:67
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.in( \"name\", new String[] { \"Fritz\", \"Izi\", \"Pk\" } ) )\n"
|
||||
" .add( Restrictions.disjunction()\n"
|
||||
" .add( Restrictions.isNull(\"age\") )\n"
|
||||
" .add( Restrictions.eq(\"age\", new Integer(0) ) )\n"
|
||||
" .add( Restrictions.eq(\"age\", new Integer(1) ) )\n"
|
||||
" .add( Restrictions.eq(\"age\", new Integer(2) ) )\n"
|
||||
" ) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:69
|
||||
#, no-c-format
|
||||
msgid "There are quite a range of built-in criterion types (<literal>Restrictions</literal> subclasses), but one that is especially useful lets you specify SQL directly."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:73(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:74
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.sqlRestriction(\"lower({alias}.name) like lower(?)\", \"Fritz%\", Hibernate.STRING) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:76
|
||||
#, no-c-format
|
||||
msgid "The <literal>{alias}</literal> placeholder with be replaced by the row alias of the queried entity."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:78(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:81
|
||||
#, no-c-format
|
||||
msgid "An alternative approach to obtaining a criterion is to get it from a <literal>Property</literal> instance. You can create a <literal>Property</literal> by calling <literal>Property.forName()</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:99(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:87
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[\n"
|
||||
"Property age = Property.forName(\"age\");\n"
|
||||
"List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.disjunction()\n"
|
||||
" .add( age.isNull() )\n"
|
||||
" .add( age.eq( new Integer(0) ) )\n"
|
||||
" .add( age.eq( new Integer(1) ) )\n"
|
||||
" .add( age.eq( new Integer(2) ) )\n"
|
||||
" ) )\n"
|
||||
" .add( Property.forName(\"name\").in( new String[] { \"Fritz\", \"Izi\", \"Pk\" } ) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:92
|
||||
#, no-c-format
|
||||
msgid "Ordering the results"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:101(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:94
|
||||
#, no-c-format
|
||||
msgid "You may order the results using <literal>org.hibernate.criterion.Order</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:122(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:98
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.like(\"name\", \"F%\")\n"
|
||||
" .addOrder( Order.asc(\"name\") )\n"
|
||||
" .addOrder( Order.desc(\"age\") )\n"
|
||||
" .setMaxResults(50)\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:100
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Property.forName(\"name\").like(\"F%\") )\n"
|
||||
" .addOrder( Property.forName(\"name\").asc() )\n"
|
||||
" .addOrder( Property.forName(\"age\").desc() )\n"
|
||||
" .setMaxResults(50)\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:105
|
||||
#, no-c-format
|
||||
msgid "Associations"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:124(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:107
|
||||
#, no-c-format
|
||||
msgid "You may easily specify constraints upon related entities by navigating associations using <literal>createCriteria()</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:135(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:112
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.like(\"name\", \"F%\") )\n"
|
||||
" .createCriteria(\"kittens\")\n"
|
||||
" .add( Restrictions.like(\"name\", \"F%\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:114
|
||||
#, no-c-format
|
||||
msgid "note that the second <literal>createCriteria()</literal> returns a new instance of <literal>Criteria</literal>, which refers to the elements of the <literal>kittens</literal> collection."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:141(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:120
|
||||
#, no-c-format
|
||||
msgid "The following, alternate form is useful in certain circumstances."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:151(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:124
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .createAlias(\"kittens\", \"kt\")\n"
|
||||
" .createAlias(\"mate\", \"mt\")\n"
|
||||
" .add( Restrictions.eqProperty(\"kt.name\", \"mt.name\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:126
|
||||
#, no-c-format
|
||||
msgid "(<literal>createAlias()</literal> does not create a new instance of <literal>Criteria</literal>.)"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:156(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:131
|
||||
#, no-c-format
|
||||
msgid "Note that the kittens collections held by the <literal>Cat</literal> instances returned by the previous two queries are <emphasis>not</emphasis> pre-filtered by the criteria! If you wish to retrieve just the kittens that match the criteria, you must use a <literal>ResultTransformer</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:178(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:138
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .createCriteria(\"kittens\", \"kt\")\n"
|
||||
" .add( Restrictions.eq(\"name\", \"F%\") )\n"
|
||||
" .setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP)\n"
|
||||
" .list();\n"
|
||||
"Iterator iter = cats.iterator();\n"
|
||||
"while ( iter.hasNext() ) {\n"
|
||||
" Map map = (Map) iter.next();\n"
|
||||
" Cat cat = (Cat) map.get(Criteria.ROOT_ALIAS);\n"
|
||||
" Cat kitten = (Cat) map.get(\"kt\");\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:143
|
||||
#, no-c-format
|
||||
msgid "Dynamic association fetching"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:180(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:145
|
||||
#, no-c-format
|
||||
msgid "You may specify association fetching semantics at runtime using <literal>setFetchMode()</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:191(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:150
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
|
||||
" .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
|
||||
" .setFetchMode(\"mate\", FetchMode.EAGER)\n"
|
||||
" .setFetchMode(\"kittens\", FetchMode.EAGER)\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:152
|
||||
#, no-c-format
|
||||
msgid "This query will fetch both <literal>mate</literal> and <literal>kittens</literal> by outer join. See <xref linkend=\"performance-fetching\"/> for more information."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:199(title)
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:160
|
||||
#, no-c-format
|
||||
msgid "Example queries"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:201(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:162
|
||||
#, no-c-format
|
||||
msgid "The class <literal>org.hibernate.criterion.Example</literal> allows you to construct a query criterion from a given instance."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:213(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:167
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Cat cat = new Cat();\n"
|
||||
"cat.setSex('F');\n"
|
||||
"cat.setColor(Color.BLACK);\n"
|
||||
"List results = session.createCriteria(Cat.class)\n"
|
||||
" .add( Example.create(cat) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:169
|
||||
#, no-c-format
|
||||
msgid "Version properties, identifiers and associations are ignored. By default, null valued properties are excluded."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:218(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:174
|
||||
#, no-c-format
|
||||
msgid "You can adjust how the <literal>Example</literal> is applied."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:231(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:178
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Example example = Example.create(cat)\n"
|
||||
" .excludeZeroes() //exclude zero valued properties\n"
|
||||
" .excludeProperty(\"color\") //exclude the property named \"color\"\n"
|
||||
" .ignoreCase() //perform case insensitive string comparisons\n"
|
||||
" .enableLike(); //use like for string comparisons\n"
|
||||
"List results = session.createCriteria(Cat.class)\n"
|
||||
" .add(example)\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:180
|
||||
#, no-c-format
|
||||
msgid "You can even use examples to place criteria upon associated objects."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:244(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:184
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .add( Example.create(cat) )\n"
|
||||
" .createCriteria(\"mate\")\n"
|
||||
" .add( Example.create( cat.getMate() ) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:189
|
||||
#, no-c-format
|
||||
msgid "Projections, aggregation and grouping"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:245(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:190
|
||||
#, no-c-format
|
||||
msgid "The class <literal>org.hibernate.criterion.Projections</literal> is a factory for <literal>Projection</literal> instances. We apply a projection to a query by calling <literal>setProjection()</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:265(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:196
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Projections.rowCount() )\n"
|
||||
" .add( Restrictions.eq(\"color\", Color.BLACK) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:198
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Projections.projectionList()\n"
|
||||
" .add( Projections.rowCount() )\n"
|
||||
" .add( Projections.avg(\"weight\") )\n"
|
||||
" .add( Projections.max(\"weight\") )\n"
|
||||
" .add( Projections.groupProperty(\"color\") )\n"
|
||||
" )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:200
|
||||
#, no-c-format
|
||||
msgid "There is no explicit \"group by\" necessary in a criteria query. Certain projection types are defined to be <emphasis>grouping projections</emphasis>, which also appear in the SQL <literal>group by</literal> clause."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:271(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:206
|
||||
#, no-c-format
|
||||
msgid "An alias may optionally be assigned to a projection, so that the projected value may be referred to in restrictions or orderings. Here are two different ways to do this:"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:287(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:212
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Projections.alias( Projections.groupProperty(\"color\"), \"colr\" ) )\n"
|
||||
" .addOrder( Order.asc(\"colr\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:214
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Projections.groupProperty(\"color\").as(\"colr\") )\n"
|
||||
" .addOrder( Order.asc(\"colr\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:216
|
||||
#, no-c-format
|
||||
msgid "The <literal>alias()</literal> and <literal>as()</literal> methods simply wrap a projection instance in another, aliased, instance of <literal>Projection</literal>. As a shortcut, you can assign an alias when you add the projection to a projection list:"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:315(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:223
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Projections.projectionList()\n"
|
||||
" .add( Projections.rowCount(), \"catCountByColor\" )\n"
|
||||
" .add( Projections.avg(\"weight\"), \"avgWeight\" )\n"
|
||||
" .add( Projections.max(\"weight\"), \"maxWeight\" )\n"
|
||||
" .add( Projections.groupProperty(\"color\"), \"color\" )\n"
|
||||
" )\n"
|
||||
" .addOrder( Order.desc(\"catCountByColor\") )\n"
|
||||
" .addOrder( Order.desc(\"avgWeight\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:225
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Domestic.class, \"cat\")\n"
|
||||
" .createAlias(\"kittens\", \"kit\")\n"
|
||||
" .setProjection( Projections.projectionList()\n"
|
||||
" .add( Projections.property(\"cat.name\"), \"catName\" )\n"
|
||||
" .add( Projections.property(\"kit.name\"), \"kitName\" )\n"
|
||||
" )\n"
|
||||
" .addOrder( Order.asc(\"catName\") )\n"
|
||||
" .addOrder( Order.asc(\"kitName\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:227
|
||||
#, no-c-format
|
||||
msgid "You can also use <literal>Property.forName()</literal> to express projections:"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:338(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:231
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Property.forName(\"name\") )\n"
|
||||
" .add( Property.forName(\"color\").eq(Color.BLACK) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:233
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[List results = session.createCriteria(Cat.class)\n"
|
||||
" .setProjection( Projections.projectionList()\n"
|
||||
" .add( Projections.rowCount().as(\"catCountByColor\") )\n"
|
||||
" .add( Property.forName(\"weight\").avg().as(\"avgWeight\") )\n"
|
||||
" .add( Property.forName(\"weight\").max().as(\"maxWeight\") )\n"
|
||||
" .add( Property.forName(\"color\").group().as(\"color\" )\n"
|
||||
" )\n"
|
||||
" .addOrder( Order.desc(\"catCountByColor\") )\n"
|
||||
" .addOrder( Order.desc(\"avgWeight\") )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:238
|
||||
#, no-c-format
|
||||
msgid "Detached queries and subqueries"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:339(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:239
|
||||
#, no-c-format
|
||||
msgid "The <literal>DetachedCriteria</literal> class lets you create a query outside the scope of a session, and then later execute it using some arbitrary <literal>Session</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:353(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:244
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[DetachedCriteria query = DetachedCriteria.forClass(Cat.class)\n"
|
||||
" .add( Property.forName(\"sex\").eq('F') );\n"
|
||||
" \n"
|
||||
"Session session = ....;\n"
|
||||
"Transaction txn = session.beginTransaction();\n"
|
||||
"List results = query.getExecutableCriteria(session).setMaxResults(100).list();\n"
|
||||
"txn.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:246
|
||||
#, no-c-format
|
||||
msgid "A <literal>DetachedCriteria</literal> may also be used to express a subquery. Criterion instances involving subqueries may be obtained via <literal>Subqueries</literal> or <literal>Property</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:371(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:252
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[DetachedCriteria avgWeight = DetachedCriteria.forClass(Cat.class)\n"
|
||||
" .setProjection( Property.forName(\"weight\").avg() );\n"
|
||||
"session.createCriteria(Cat.class)\n"
|
||||
" .add( Property.forName(\"weight\").gt(avgWeight) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:254
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[DetachedCriteria weights = DetachedCriteria.forClass(Cat.class)\n"
|
||||
" .setProjection( Property.forName(\"weight\") );\n"
|
||||
"session.createCriteria(Cat.class)\n"
|
||||
" .add( Subqueries.geAll(\"weight\", weights) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:256
|
||||
#, no-c-format
|
||||
msgid "Even correlated subqueries are possible:"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:389(title)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:260
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[DetachedCriteria avgWeightForSex = DetachedCriteria.forClass(Cat.class, \"cat2\")\n"
|
||||
" .setProjection( Property.forName(\"weight\").avg() )\n"
|
||||
" .add( Property.forName(\"cat2.sex\").eqProperty(\"cat.sex\") );\n"
|
||||
"session.createCriteria(Cat.class, \"cat\")\n"
|
||||
" .add( Property.forName(\"weight\").gt(avgWeightForSex) )\n"
|
||||
" .list();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: query_criteria.xml:269
|
||||
#, no-c-format
|
||||
msgid "Queries by natural identifier"
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:391(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:271
|
||||
#, no-c-format
|
||||
msgid "For most queries, including criteria queries, the query cache is not very efficient, because query cache invalidation occurs too frequently. However, there is one special kind of query where we can optimize the cache invalidation algorithm: lookups by a constant natural key. In some applications, this kind of query occurs frequently. The criteria API provides special provision for this use case."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:399(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:279
|
||||
#, no-c-format
|
||||
msgid "First, you should map the natural key of your entity using <literal><natural-id></literal>, and enable use of the second-level cache."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:416(para)
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:284
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"User\">\n"
|
||||
" <cache usage=\"read-write\"/>\n"
|
||||
" <id name=\"id\">\n"
|
||||
" <generator class=\"increment\"/>\n"
|
||||
" </id>\n"
|
||||
" <natural-id>\n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" <property name=\"org\"/>\n"
|
||||
" </natural-id>\n"
|
||||
" <property name=\"password\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:286
|
||||
#, no-c-format
|
||||
msgid "Note that this functionality is not intended for use with entities with <emphasis>mutable</emphasis> natural keys."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:421(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:291
|
||||
#, no-c-format
|
||||
msgid "Next, enable the Hibernate query cache."
|
||||
msgstr ""
|
||||
|
||||
#: query_criteria.xml:425(para)
|
||||
#. Tag: para
|
||||
#: query_criteria.xml:295
|
||||
#, no-c-format
|
||||
msgid "Now, <literal>Restrictions.naturalId()</literal> allows us to make use of the more efficient cache algorithm."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: query_criteria.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
#. Tag: programlisting
|
||||
#: query_criteria.xml:300
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[session.createCriteria(User.class)\n"
|
||||
" .add( Restrictions.naturalId()\n"
|
||||
" .set(\"name\", \"gavin\")\n"
|
||||
" .set(\"org\", \"hb\") \n"
|
||||
" ).setCacheable(true)\n"
|
||||
" .uniqueResult();]]>"
|
||||
msgstr ""
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,120 +1,356 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:35-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: xml.xml:5(title)
|
||||
#. Tag: title
|
||||
#: xml.xml:29
|
||||
#, no-c-format
|
||||
msgid "XML Mapping"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:7(emphasis)
|
||||
#. Tag: emphasis
|
||||
#: xml.xml:31
|
||||
#, no-c-format
|
||||
msgid "Note that this is an experimental feature in Hibernate 3.0 and is under extremely active development."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:13(title)
|
||||
#. Tag: title
|
||||
#: xml.xml:37
|
||||
#, no-c-format
|
||||
msgid "Working with XML data"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:15(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:39
|
||||
#, no-c-format
|
||||
msgid "Hibernate lets you work with persistent XML data in much the same way you work with persistent POJOs. A parsed XML tree can be thought of as just another way to represent the relational data at the object level, instead of POJOs."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:22(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:46
|
||||
#, no-c-format
|
||||
msgid "Hibernate supports dom4j as API for manipulating XML trees. You can write queries that retrieve dom4j trees from the database and have any modification you make to the tree automatically synchronized to the database. You can even take an XML document, parse it using dom4j, and write it to the database with any of Hibernate's basic operations: <literal>persist(), saveOrUpdate(), merge(), delete(), replicate()</literal> (merging is not yet supported)."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:32(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:56
|
||||
#, no-c-format
|
||||
msgid "This feature has many applications including data import/export, externalization of entity data via JMS or SOAP and XSLT-based reporting."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:37(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:61
|
||||
#, no-c-format
|
||||
msgid "A single mapping may be used to simultaneously map properties of a class and nodes of an XML document to the database, or, if there is no class to map, it may be used to map just the XML."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:44(title)
|
||||
#. Tag: title
|
||||
#: xml.xml:68
|
||||
#, no-c-format
|
||||
msgid "Specifying XML and class mapping together"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:46(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:70
|
||||
#, no-c-format
|
||||
msgid "Here is an example of mapping a POJO and XML simultaneously:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:73(title)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:74
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Account\" \n"
|
||||
" table=\"ACCOUNTS\" \n"
|
||||
" node=\"account\">\n"
|
||||
" \n"
|
||||
" <id name=\"accountId\" \n"
|
||||
" column=\"ACCOUNT_ID\" \n"
|
||||
" node=\"@id\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customer\" \n"
|
||||
" column=\"CUSTOMER_ID\" \n"
|
||||
" node=\"customer/@id\" \n"
|
||||
" embed-xml=\"false\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"balance\" \n"
|
||||
" column=\"BALANCE\" \n"
|
||||
" node=\"balance\"/>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: xml.xml:78
|
||||
#, no-c-format
|
||||
msgid "Specifying only an XML mapping"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:75(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:80
|
||||
#, no-c-format
|
||||
msgid "Here is an example where there is no POJO class:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:103(para)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:84
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class entity-name=\"Account\" \n"
|
||||
" table=\"ACCOUNTS\" \n"
|
||||
" node=\"account\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"ACCOUNT_ID\" \n"
|
||||
" node=\"@id\" \n"
|
||||
" type=\"string\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customerId\" \n"
|
||||
" column=\"CUSTOMER_ID\" \n"
|
||||
" node=\"customer/@id\" \n"
|
||||
" embed-xml=\"false\" \n"
|
||||
" entity-name=\"Customer\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"balance\" \n"
|
||||
" column=\"BALANCE\" \n"
|
||||
" node=\"balance\" \n"
|
||||
" type=\"big_decimal\"/>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:86
|
||||
#, no-c-format
|
||||
msgid "This mapping allows you to access the data as a dom4j tree, or as a graph of property name/value pairs (java <literal>Map</literal>s). The property names are purely logical constructs that may be referred to in HQL queries."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:114(title)
|
||||
#. Tag: title
|
||||
#: xml.xml:97
|
||||
#, no-c-format
|
||||
msgid "XML mapping metadata"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:116(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:99
|
||||
#, no-c-format
|
||||
msgid "Many Hibernate mapping elements accept the <literal>node</literal> attribute. This let's you specify the name of an XML attribute or element that holds the property or entity data. The format of the <literal>node</literal> attribute must be one of the following:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:125(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:108
|
||||
#, no-c-format
|
||||
msgid "<literal>\"element-name\"</literal> - map to the named XML element"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:128(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:111
|
||||
#, no-c-format
|
||||
msgid "<literal>\"@attribute-name\"</literal> - map to the named XML attribute"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:131(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:114
|
||||
#, no-c-format
|
||||
msgid "<literal>\".\"</literal> - map to the parent element"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:134(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:117
|
||||
#, no-c-format
|
||||
msgid "<literal>\"element-name/@attribute-name\"</literal> - map to the named attribute of the named element"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:141(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:124
|
||||
#, no-c-format
|
||||
msgid "For collections and single valued associations, there is an additional <literal>embed-xml</literal> attribute. If <literal>embed-xml=\"true\"</literal>, the default, the XML tree for the associated entity (or collection of value type) will be embedded directly in the XML tree for the entity that owns the association. Otherwise, if <literal>embed-xml=\"false\"</literal>, then only the referenced identifier value will appear in the XML for single point associations and collections will simply not appear at all."
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:151(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:134
|
||||
#, no-c-format
|
||||
msgid "You should be careful not to leave <literal>embed-xml=\"true\"</literal> for too many associations, since XML does not deal well with circularity!"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:191(para)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:139
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Customer\" \n"
|
||||
" table=\"CUSTOMER\" \n"
|
||||
" node=\"customer\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"CUST_ID\" \n"
|
||||
" node=\"@id\"/>\n"
|
||||
" \n"
|
||||
" <map name=\"accounts\" \n"
|
||||
" node=\".\" \n"
|
||||
" embed-xml=\"true\">\n"
|
||||
" <key column=\"CUSTOMER_ID\" \n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" <map-key column=\"SHORT_DESC\" \n"
|
||||
" node=\"@short-desc\" \n"
|
||||
" type=\"string\"/>\n"
|
||||
" <one-to-many entity-name=\"Account\"\n"
|
||||
" embed-xml=\"false\" \n"
|
||||
" node=\"account\"/>\n"
|
||||
" </map>\n"
|
||||
" \n"
|
||||
" <component name=\"name\" \n"
|
||||
" node=\"name\">\n"
|
||||
" <property name=\"firstName\" \n"
|
||||
" node=\"first-name\"/>\n"
|
||||
" <property name=\"initial\" \n"
|
||||
" node=\"initial\"/>\n"
|
||||
" <property name=\"lastName\" \n"
|
||||
" node=\"last-name\"/>\n"
|
||||
" </component>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:141
|
||||
#, no-c-format
|
||||
msgid "in this case, we have decided to embed the collection of account ids, but not the actual account data. The following HQL query:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:198(para)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:146
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[from Customer c left join fetch c.accounts where c.lastName like :lastName]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:148
|
||||
#, no-c-format
|
||||
msgid "Would return datasets such as this:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:213(para)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:152
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<customer id=\"123456789\">\n"
|
||||
" <account short-desc=\"Savings\">987632567</account>\n"
|
||||
" <account short-desc=\"Credit Card\">985612323</account>\n"
|
||||
" <name>\n"
|
||||
" <first-name>Gavin</first-name>\n"
|
||||
" <initial>A</initial>\n"
|
||||
" <last-name>King</last-name>\n"
|
||||
" </name>\n"
|
||||
" ...\n"
|
||||
"</customer>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:154
|
||||
#, no-c-format
|
||||
msgid "If you set <literal>embed-xml=\"true\"</literal> on the <literal><one-to-many></literal> mapping, the data might look more like this:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:239(title)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:159
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<customer id=\"123456789\">\n"
|
||||
" <account id=\"987632567\" short-desc=\"Savings\">\n"
|
||||
" <customer id=\"123456789\"/>\n"
|
||||
" <balance>100.29</balance>\n"
|
||||
" </account>\n"
|
||||
" <account id=\"985612323\" short-desc=\"Credit Card\">\n"
|
||||
" <customer id=\"123456789\"/>\n"
|
||||
" <balance>-2370.34</balance>\n"
|
||||
" </account>\n"
|
||||
" <name>\n"
|
||||
" <first-name>Gavin</first-name>\n"
|
||||
" <initial>A</initial>\n"
|
||||
" <last-name>King</last-name>\n"
|
||||
" </name>\n"
|
||||
" ...\n"
|
||||
"</customer>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: xml.xml:165
|
||||
#, no-c-format
|
||||
msgid "Manipulating XML data"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:241(para)
|
||||
#. Tag: para
|
||||
#: xml.xml:167
|
||||
#, no-c-format
|
||||
msgid "Let's rearead and update XML documents in the application. We do this by obtaining a dom4j session:"
|
||||
msgstr ""
|
||||
|
||||
#: xml.xml:281(para)
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:172
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Document doc = ....;\n"
|
||||
" \n"
|
||||
"Session session = factory.openSession();\n"
|
||||
"Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"List results = dom4jSession\n"
|
||||
" .createQuery(\"from Customer c left join fetch c.accounts where c.lastName like :lastName\")\n"
|
||||
" .list();\n"
|
||||
"for ( int i=0; i<results.size(); i++ ) {\n"
|
||||
" //add the customer data to the XML document\n"
|
||||
" Element customer = (Element) results.get(i);\n"
|
||||
" doc.add(customer);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:174
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = factory.openSession();\n"
|
||||
"Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"Element cust = (Element) dom4jSession.get(\"Customer\", customerId);\n"
|
||||
"for ( int i=0; i<results.size(); i++ ) {\n"
|
||||
" Element customer = (Element) results.get(i);\n"
|
||||
" //change the customer name in the XML and database\n"
|
||||
" Element name = customer.element(\"name\");\n"
|
||||
" name.element(\"first-name\").setText(firstName);\n"
|
||||
" name.element(\"initial\").setText(initial);\n"
|
||||
" name.element(\"last-name\").setText(lastName);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:176
|
||||
#, no-c-format
|
||||
msgid "It is extremely useful to combine this feature with Hibernate's <literal>replicate()</literal> operation to implement XML-based data import/export."
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: xml.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,96 +1,58 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2007-10-19 10:26-0500\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2008-05-07 21:01+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"
|
||||
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ./legal_notice.xml:20(title)
|
||||
#. Tag: title
|
||||
#: legal_notice.xml:28
|
||||
#, no-c-format
|
||||
msgid "Legal Notice"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:23(street)
|
||||
msgid "1801 Varsity Drive"
|
||||
#. Tag: address
|
||||
#: legal_notice.xml:30
|
||||
#, no-c-format
|
||||
msgid "<street>1801 Varsity Drive</street> <city>Raleigh</city>, <state>NC</state><postcode>27606-2072</postcode><country>USA</country> <phone>Phone: +1 919 754 3700</phone> <phone>Phone: 888 733 4281</phone> <fax>Fax: +1 919 754 3701</fax> <pob>PO Box 13588</pob><city>Research Triangle Park</city>, <state>NC</state><postcode>27709</postcode><country>USA</country>"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:24(city)
|
||||
msgid "Raleigh"
|
||||
#. Tag: para
|
||||
#: legal_notice.xml:39
|
||||
#, no-c-format
|
||||
msgid "Copyright <trademark class=\"copyright\"></trademark> 2007 by Red Hat, Inc. This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the GNU <ulink url=\"http://www.gnu.org/licenses/lgpl-2.1.html\">Lesser General Public License</ulink>, as published by the Free Software Foundation."
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:24(state) ./legal_notice.xml:28(state)
|
||||
msgid "NC"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:24(postcode)
|
||||
msgid "27606-2072"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:24(country) ./legal_notice.xml:28(country)
|
||||
msgid "USA"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:25(phone)
|
||||
msgid "Phone: +1 919 754 3700"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:26(phone)
|
||||
msgid "Phone: 888 733 4281"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:27(fax)
|
||||
msgid "Fax: +1 919 754 3701"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:28(pob)
|
||||
msgid "PO Box 13588"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:28(city)
|
||||
msgid "Research Triangle Park"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:28(postcode)
|
||||
msgid "27709"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:22(address)
|
||||
msgid "<placeholder-1/><placeholder-2/>, <placeholder-3/><placeholder-4/><placeholder-5/><placeholder-6/><placeholder-7/><placeholder-8/><placeholder-9/><placeholder-10/>, <placeholder-11/><placeholder-12/><placeholder-13/>"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:31(para)
|
||||
msgid "Copyright <trademark class=\"copyright\"/> 2007 by Red Hat, Inc. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, V1.0 or later (the latest version is presently available at <ulink url=\"http://www.opencontent.org/openpub/\">http://www.opencontent.org/openpub/</ulink>)."
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:34(para)
|
||||
msgid "Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder."
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:37(para)
|
||||
msgid "Distribution of the work or derivative of the work in any standard (paper) book form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder."
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:40(para)
|
||||
#. Tag: para
|
||||
#: legal_notice.xml:45
|
||||
#, no-c-format
|
||||
msgid "Red Hat and the Red Hat \"Shadow Man\" logo are registered trademarks of Red Hat, Inc. in the United States and other countries."
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:43(para)
|
||||
#. Tag: para
|
||||
#: legal_notice.xml:48
|
||||
#, no-c-format
|
||||
msgid "All other trademarks referenced herein are the property of their respective owners."
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:46(para)
|
||||
#. Tag: para
|
||||
#: legal_notice.xml:51
|
||||
#, no-c-format
|
||||
msgid "The GPG fingerprint of the security@redhat.com key is:"
|
||||
msgstr ""
|
||||
|
||||
#: ./legal_notice.xml:49(para)
|
||||
#. Tag: para
|
||||
#: legal_notice.xml:54
|
||||
#, no-c-format
|
||||
msgid "CA 20 86 86 2B D6 9D FC 65 F6 EC C4 21 91 80 CD DB 42 A6 0E"
|
||||
msgstr ""
|
||||
|
||||
#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.
|
||||
#: ./legal_notice.xml:0(None)
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue